Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Hannes Bornö committed Sep 6, 2022
1 parent e7bed87 commit 0f93f55
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 13 deletions.
10 changes: 4 additions & 6 deletions test/e2e/app-dir/rsc-basic.test.ts
Expand Up @@ -386,20 +386,18 @@ describe('app dir - react server components', () => {

if (!isNextDev) {
it('should generate edge SSR manifests for Node.js', async () => {
const distServerDir = path.join(distDir, 'server')

const requiredServerFiles = (
await fs.readJSON(path.join(distDir, 'required-server-files.json'))
).files

const files = [
'middleware-build-manifest.js',
'middleware-manifest.json',
'flight-manifest.json',
'server/middleware-build-manifest.js',
'edge/middleware-manifest.json',
'server/flight-manifest.json',
]

files.forEach((file) => {
const filepath = path.join(distServerDir, file)
const filepath = path.join(distDir, file)
expect(fs.existsSync(filepath)).toBe(true)
})

Expand Down
10 changes: 4 additions & 6 deletions test/e2e/edge-compiler-can-import-blob-assets/index.test.ts
Expand Up @@ -74,7 +74,7 @@ describe('Edge Compiler can import asset assets', () => {
it('extracts all the assets from the bundle', async () => {
const manifestPath = path.join(
next.testDir,
'.next/server/middleware-manifest.json'
'.next/edge/middleware-manifest.json'
)
const manifest: MiddlewareManifest = await readJson(manifestPath)
const orderedAssets = manifest.functions['/api/edge'].assets.sort(
Expand All @@ -86,17 +86,15 @@ describe('Edge Compiler can import asset assets', () => {
expect(orderedAssets).toMatchObject([
{
name: expect.stringMatching(/^text-file\.[0-9a-f]{16}\.txt$/),
filePath: expect.stringMatching(
/^server\/edge-chunks\/asset_text-file/
),
filePath: expect.stringMatching(/^edge\/edge-chunks\/asset_text-file/),
},
{
name: expect.stringMatching(/^vercel\.[0-9a-f]{16}\.png$/),
filePath: expect.stringMatching(/^server\/edge-chunks\/asset_vercel/),
filePath: expect.stringMatching(/^edge\/edge-chunks\/asset_vercel/),
},
{
name: expect.stringMatching(/^world\.[0-9a-f]{16}\.json/),
filePath: expect.stringMatching(/^server\/edge-chunks\/asset_world/),
filePath: expect.stringMatching(/^edge\/edge-chunks\/asset_world/),
},
])
})
Expand Down
Expand Up @@ -39,6 +39,7 @@ describe('Required Server Files', () => {
for (const file of files) {
if (
file === 'server' ||
file === 'edge' ||
file === 'required-server-files.json' ||
requiredFilesManifest.files.includes(join('.next', file))
) {
Expand Down
Expand Up @@ -59,7 +59,7 @@ describe('dependencies can use env vars in middlewares', () => {
const testDir = next.testDir
const manifestPath = path.join(
testDir,
'.next/server/middleware-manifest.json'
'.next/edge/middleware-manifest.json'
)
const manifest = await readJson(manifestPath)
const envVars = manifest?.middleware?.['/']?.env
Expand Down

0 comments on commit 0f93f55

Please sign in to comment.