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

Function runTests

test/integration/revalidate-as-path/test/index.test.ts:30–70  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

28}
29
30const runTests = () => {
31 it('should render with correct asPath with /_next/data /index requested', async () => {
32 stdout = ''
33 const path = `/_next/data/${buildId}/index.json`
34 await renderViaHTTP(appPort, path)
35 await waitFor(1000)
36 const data = await renderViaHTTP(appPort, path)
37
38 expect(JSON.parse(data).pageProps).toEqual({
39 hello: 'world',
40 })
41
42 await check(() => stdout, /asPath/)
43 const asPath = stdout.split('asPath: ').pop().split('\n').shift()
44 expect(asPath).toBe('/')
45 })
46
47 it('should render with correct asPath with / requested', async () => {
48 await checkAsPath('/', '/')
49 })
50
51 it('should render with correct asPath with /another/index requested', async () => {
52 await checkAsPath('/another/index', '/another/index')
53 })
54
55 it('should render with correct asPath with /_next/data /another/index requested', async () => {
56 stdout = ''
57 const path = `/_next/data/${buildId}/another/index.json`
58 await renderViaHTTP(appPort, path)
59 await waitFor(1000)
60 const data = await renderViaHTTP(appPort, path)
61
62 expect(JSON.parse(data).pageProps).toEqual({
63 hello: 'world',
64 })
65
66 await check(() => stdout, /asPath/)
67 const asPath = stdout.split('asPath: ').pop().split('\n').shift()
68 expect(asPath).toBe('/another/index')
69 })
70}
71
72describe('Revalidate asPath Normalizing', () => {
73 ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(

Callers 1

index.test.tsFile · 0.70

Calls 10

renderViaHTTPFunction · 0.90
waitForFunction · 0.90
checkFunction · 0.90
checkAsPathFunction · 0.85
splitMethod · 0.80
itFunction · 0.50
expectFunction · 0.50
parseMethod · 0.45
shiftMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected