MCPcopy
hub / github.com/vercel/next.js / runTests

Function runTests

test/integration/invalid-custom-routes/test/index.test.ts:26–603  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

24let start
25
26const runTests = () => {
27 it('should error when empty headers array is present on header item', async () => {
28 await writeConfig(
29 [
30 {
31 source: `/:path*`,
32 headers: [],
33 },
34 ],
35 'headers'
36 )
37 await start()
38 await retry(() => {
39 const stderr = getStderr()
40 expect(stderr).toContain(
41 '`headers` field cannot be empty for route {"source":"/:path*"'
42 )
43 })
44 })
45
46 it('should error when source and destination length is exceeded', async () => {
47 await writeConfig(
48 [
49 {
50 source: `/${Array(4096).join('a')}`,
51 destination: `/another`,
52 permanent: false,
53 },
54 {
55 source: `/`,
56 destination: `/${Array(4096).join('a')}`,
57 permanent: false,
58 },
59 ],
60 'redirects'
61 )
62 await start()
63 await retry(() => {
64 const stderr = getStderr()
65 expect(stderr).toContain(
66 '`source` exceeds max built length of 4096 for route {"source":"/aaaaaaaaaaaaaaaaaa'
67 )
68 expect(stderr).toContain(
69 '`destination` exceeds max built length of 4096 for route {"source":"/","destination":"/aaaa'
70 )
71 })
72 })
73
74 it('should error during next build for invalid redirects', async () => {
75 await writeConfig(
76 [
77 {
78 // missing destination
79 source: '/hello',
80 permanent: false,
81 },
82 {
83 // invalid source

Callers 1

index.test.tsFile · 0.70

Calls 7

retryFunction · 0.90
getStderrFunction · 0.85
writeConfigFunction · 0.70
itFunction · 0.50
startFunction · 0.50
expectFunction · 0.50
joinMethod · 0.45

Tested by

no test coverage detected