Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add e2e test for function config manifest
- Loading branch information
Showing
4 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
test/e2e/app-dir/with-exported-function-config/app/foo/bar/route.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { NextResponse } from 'next/server' | ||
|
||
export async function GET() { | ||
return NextResponse.json({ hello: 'world' }) | ||
} | ||
|
||
export const runtime = 'edge' | ||
export const maxDuration = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { NextResponse } from 'next/server' | ||
|
||
export async function GET() { | ||
return NextResponse.json({ hello: 'world' }) | ||
} | ||
|
||
export const maxDuration = 5 |
6 changes: 6 additions & 0 deletions
6
test/e2e/app-dir/with-exported-function-config/next.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/** | ||
* @type {import('next').NextConfig} | ||
*/ | ||
const nextConfig = {} | ||
|
||
module.exports = nextConfig |
28 changes: 28 additions & 0 deletions
28
test/e2e/app-dir/with-exported-function-config/with-exported-function-config.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { createNextDescribe } from 'e2e-utils' | ||
|
||
createNextDescribe( | ||
'with-exported-function-config', | ||
{ | ||
files: __dirname, | ||
}, | ||
({ next, isNextStart }) => { | ||
if (isNextStart) { | ||
it('should have correct values in function config manifest', async () => { | ||
const functionsConfigManifest = JSON.parse( | ||
await next.readFile('.next/server/functions-config-manifest.json') | ||
) | ||
|
||
expect(functionsConfigManifest).toMatchInlineSnapshot(` | ||
Object { | ||
"/": Object { | ||
"maxDuration": 5, | ||
}, | ||
"/foo/bar": Object { | ||
"maxDuration": 2, | ||
}, | ||
} | ||
`) | ||
}) | ||
} | ||
} | ||
) |