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

Function runTests

test/integration/gssp-redirect/test/index.test.ts:20–504  ·  view source on GitHub ↗
(isDev: boolean)

Source from the content-addressed store, hash-verified

18let appPort
19
20const runTests = (isDev: boolean) => {
21 it('should apply temporary redirect when visited directly for GSSP page', async () => {
22 const res = await fetchViaHTTP(
23 appPort,
24 '/gssp-blog/redirect-1',
25 undefined,
26 {
27 redirect: 'manual',
28 }
29 )
30 expect(res.status).toBe(307)
31
32 const { pathname } = new URL(res.headers.get('location'))
33
34 expect(pathname).toBe('/404')
35 })
36
37 it('should apply permanent redirect when visited directly for GSSP page', async () => {
38 const res = await fetchViaHTTP(
39 appPort,
40 '/gssp-blog/redirect-permanent',
41 undefined,
42 {
43 redirect: 'manual',
44 }
45 )
46 expect(res.status).toBe(308)
47
48 const { pathname } = new URL(res.headers.get('location'))
49
50 expect(pathname).toBe('/404')
51 expect(res.headers.get('refresh')).toMatch(/url=\/404/)
52 })
53
54 it('should apply statusCode 301 redirect when visited directly for GSSP page', async () => {
55 const res = await fetchViaHTTP(
56 appPort,
57 '/gssp-blog/redirect-statusCode-301',
58 undefined,
59 {
60 redirect: 'manual',
61 }
62 )
63 expect(res.status).toBe(301)
64
65 const { pathname } = new URL(res.headers.get('location'))
66
67 expect(pathname).toBe('/404')
68 expect(res.headers.get('refresh')).toBe(null)
69 })
70
71 it('should apply statusCode 303 redirect when visited directly for GSSP page', async () => {
72 const res = await fetchViaHTTP(
73 appPort,
74 '/gssp-blog/redirect-statusCode-303',
75 undefined,
76 {
77 redirect: 'manual',

Callers 1

index.test.tsFile · 0.70

Calls 12

fetchViaHTTPFunction · 0.90
checkFunction · 0.90
webdriverFunction · 0.85
waitForElementByCssMethod · 0.80
elementByCssMethod · 0.80
evalMethod · 0.80
getMethod · 0.65
textMethod · 0.65
urlMethod · 0.65
itFunction · 0.50
expectFunction · 0.50
parseMethod · 0.45

Tested by

no test coverage detected