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

Function runTests

test/integration/custom-routes/test/index.test.ts:41–2555  ·  view source on GitHub ↗
(isDev = false)

Source from the content-addressed store, hash-verified

39let app
40
41const runTests = (isDev = false) => {
42 it.each([
43 {
44 path: '/to-ANOTHER',
45 content: /could not be found/,
46 status: 404,
47 },
48 {
49 path: '/HELLO-world',
50 content: /could not be found/,
51 status: 404,
52 },
53 {
54 path: '/docs/GITHUB',
55 content: /could not be found/,
56 status: 404,
57 },
58 {
59 path: '/add-HEADER',
60 content: /could not be found/,
61 status: 404,
62 },
63 ])(
64 'should honor caseSensitiveRoutes config for $path',
65 async ({ path, status, content }) => {
66 const res = await fetchViaHTTP(appPort, path, undefined, {
67 redirect: 'manual',
68 })
69
70 if (status) {
71 expect(res.status).toBe(status)
72 }
73
74 if (content) {
75 expect(await res.text()).toMatch(content)
76 }
77 }
78 )
79
80 it('should successfully rewrite a WebSocket request', async () => {
81 const messages = []
82 const ws = await new Promise<WebSocket>((resolve, reject) => {
83 let socket = new WebSocket(`ws://localhost:${appPort}/to-websocket`)
84 socket.on('message', (data) => {
85 messages.push(data.toString())
86 })
87 socket.on('open', () => resolve(socket))
88 socket.on('error', (err) => {
89 console.error(err)
90 socket.close()
91 reject()
92 })
93 })
94
95 await check(
96 () => (messages.length > 0 ? 'success' : JSON.stringify(messages)),
97 'success'
98 )

Callers 1

index.test.tsFile · 0.70

Calls 15

closeMethod · 0.95
fetchViaHTTPFunction · 0.90
checkFunction · 0.90
waitForNoRedboxFunction · 0.90
renderViaHTTPFunction · 0.90
getBrowserBodyTextFunction · 0.90
waitForFunction · 0.90
joinFunction · 0.90
normalizeRegExFunction · 0.90
normalizeManifestFunction · 0.90
webdriverFunction · 0.85
eachMethod · 0.80

Tested by

no test coverage detected