Skip to content

Commit

Permalink
add e2e test for function config manifest
Browse files Browse the repository at this point in the history
  • Loading branch information
ecklf committed Jun 29, 2023
1 parent 9d26318 commit f523867
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 0 deletions.
@@ -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
7 changes: 7 additions & 0 deletions test/e2e/app-dir/with-exported-function-config/app/route.ts
@@ -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 test/e2e/app-dir/with-exported-function-config/next.config.js
@@ -0,0 +1,6 @@
/**
* @type {import('next').NextConfig}
*/
const nextConfig = {}

module.exports = nextConfig
@@ -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,
},
}
`)
})
}
}
)

0 comments on commit f523867

Please sign in to comment.