@@ -4,12 +4,13 @@ import { describeCwdTmpDir, moveNextDist } from '../test-utils'
4
4
describeCwdTmpDir ( 'api route file analysis' , ( ) => {
5
5
it ( 'extracts correct route configs from source files' , async ( ) => {
6
6
await moveNextDist ( )
7
- const configs = await getApiRouteConfigs ( '.next' , process . cwd ( ) , [ 'js' , 'jsx' , 'ts' , 'tsx' ] )
7
+ const configs = await getApiRouteConfigs ( '.next' , process . cwd ( ) )
8
8
// Using a Set means the order doesn't matter
9
9
expect ( new Set ( configs . map ( ( { includedFiles, ...rest } ) => rest ) ) ) . toEqual (
10
10
new Set ( [
11
11
{
12
12
functionName : '_api_og-handler' ,
13
+ functionTitle : 'Next.js API handler /api/og' ,
13
14
compiled : 'pages/api/og.js' ,
14
15
config : {
15
16
runtime : 'edge' ,
@@ -18,48 +19,56 @@ describeCwdTmpDir('api route file analysis', () => {
18
19
} ,
19
20
{
20
21
functionName : '_api_enterPreview-handler' ,
22
+ functionTitle : 'Next.js API handler /api/enterPreview' ,
21
23
compiled : 'pages/api/enterPreview.js' ,
22
24
config : { } ,
23
25
route : '/api/enterPreview' ,
24
26
} ,
25
27
{
26
28
functionName : '_api_exitPreview-handler' ,
29
+ functionTitle : 'Next.js API handler /api/exitPreview' ,
27
30
compiled : 'pages/api/exitPreview.js' ,
28
31
config : { } ,
29
32
route : '/api/exitPreview' ,
30
33
} ,
31
34
{
32
35
functionName : '_api_hello-handler' ,
36
+ functionTitle : 'Next.js API handler /api/hello' ,
33
37
compiled : 'pages/api/hello.js' ,
34
38
config : { } ,
35
39
route : '/api/hello' ,
36
40
} ,
37
41
{
38
42
functionName : '_api_shows_params-SPLAT-handler' ,
43
+ functionTitle : 'Next.js API handler /api/shows/[...params]' ,
39
44
compiled : 'pages/api/shows/[...params].js' ,
40
45
config : { } ,
41
46
route : '/api/shows/[...params]' ,
42
47
} ,
43
48
{
44
49
functionName : '_api_shows_id-PARAM-handler' ,
50
+ functionTitle : 'Next.js API handler /api/shows/[id]' ,
45
51
compiled : 'pages/api/shows/[id].js' ,
46
52
config : { } ,
47
53
route : '/api/shows/[id]' ,
48
54
} ,
49
55
{
50
56
functionName : '_api_hello-background-background' ,
57
+ functionTitle : 'Next.js API handler /api/hello-background' ,
51
58
compiled : 'pages/api/hello-background.js' ,
52
59
config : { type : 'experimental-background' } ,
53
60
route : '/api/hello-background' ,
54
61
} ,
55
62
{
56
63
functionName : '_api_hello-scheduled-handler' ,
64
+ functionTitle : 'Next.js API handler /api/hello-scheduled' ,
57
65
compiled : 'pages/api/hello-scheduled.js' ,
58
66
config : { schedule : '@hourly' , type : 'experimental-scheduled' } ,
59
67
route : '/api/hello-scheduled' ,
60
68
} ,
61
69
{
62
70
functionName : '_api_revalidate-handler' ,
71
+ functionTitle : 'Next.js API handler /api/revalidate' ,
63
72
compiled : 'pages/api/revalidate.js' ,
64
73
config : { } ,
65
74
route : '/api/revalidate' ,
@@ -70,18 +79,20 @@ describeCwdTmpDir('api route file analysis', () => {
70
79
71
80
it ( 'only shows scheduled/background functions as extended funcs' , async ( ) => {
72
81
await moveNextDist ( )
73
- const configs = await getExtendedApiRouteConfigs ( '.next' , process . cwd ( ) , [ ] )
82
+ const configs = await getExtendedApiRouteConfigs ( '.next' , process . cwd ( ) )
74
83
// Using a Set means the order doesn't matter
75
84
expect ( new Set ( configs . map ( ( { includedFiles, ...rest } ) => rest ) ) ) . toEqual (
76
85
new Set ( [
77
86
{
78
87
functionName : '_api_hello-background-background' ,
88
+ functionTitle : 'Next.js API handler /api/hello-background' ,
79
89
compiled : 'pages/api/hello-background.js' ,
80
90
config : { type : 'experimental-background' } ,
81
91
route : '/api/hello-background' ,
82
92
} ,
83
93
{
84
94
functionName : '_api_hello-scheduled-handler' ,
95
+ functionTitle : 'Next.js API handler /api/hello-scheduled' ,
85
96
compiled : 'pages/api/hello-scheduled.js' ,
86
97
config : { schedule : '@hourly' , type : 'experimental-scheduled' } ,
87
98
route : '/api/hello-scheduled' ,
0 commit comments