Skip to content

Remove isTurbo check in custom-routes test #56360

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 1 addition & 103 deletions test/integration/custom-routes/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ let buildId
let appPort
let app

const runTests = (isDev = false, isTurbo = false) => {
const runTests = (isDev = false) => {
it.each([
{
path: '/to-ANOTHER',
Expand Down Expand Up @@ -78,9 +78,6 @@ const runTests = (isDev = false, isTurbo = false) => {
)

it('should successfully rewrite a WebSocket request', async () => {
// TODO: remove once test failure has been fixed
if (isTurbo) return

const messages = []
const ws = await new Promise((resolve, reject) => {
let socket = new WebSocket(`ws://localhost:${appPort}/to-websocket`)
Expand All @@ -104,9 +101,6 @@ const runTests = (isDev = false, isTurbo = false) => {
})

it('should successfully rewrite a WebSocket request to a page', async () => {
// TODO: remove once test failure has been fixed
if (isTurbo) return

const messages = []
try {
const ws = await new Promise((resolve, reject) => {
Expand Down Expand Up @@ -147,9 +141,6 @@ const runTests = (isDev = false, isTurbo = false) => {
})

it('should handle has query encoding correctly', async () => {
// TODO: remove once test failure has been fixed
if (isTurbo) return

for (const expected of [
{
post: 'first',
Expand Down Expand Up @@ -192,9 +183,6 @@ const runTests = (isDev = false, isTurbo = false) => {
})

it('should handle external beforeFiles rewrite correctly', async () => {
// TODO: remove once test failure has been fixed
if (isTurbo) return

const res = await fetchViaHTTP(appPort, '/overridden')
const html = await res.text()

Expand All @@ -213,9 +201,6 @@ const runTests = (isDev = false, isTurbo = false) => {
})

it('should handle beforeFiles rewrite to dynamic route correctly', async () => {
// TODO: remove once test failure has been fixed
if (isTurbo) return

const res = await fetchViaHTTP(appPort, '/nfl')
const html = await res.text()

Expand All @@ -242,9 +227,6 @@ const runTests = (isDev = false, isTurbo = false) => {
})

it('should handle beforeFiles rewrite to partly dynamic route correctly', async () => {
// TODO: remove once test failure has been fixed
if (isTurbo) return

const res = await fetchViaHTTP(appPort, '/nfl')
const html = await res.text()

Expand Down Expand Up @@ -282,9 +264,6 @@ const runTests = (isDev = false, isTurbo = false) => {
})

it('should resolveHref correctly navigating through history', async () => {
// TODO: remove once test failure has been fixed
if (isTurbo) return

const browser = await webdriver(appPort, '/')
await browser.eval('window.beforeNav = 1')

Expand Down Expand Up @@ -340,9 +319,6 @@ const runTests = (isDev = false, isTurbo = false) => {
})

it('should not hang when proxy rewrite fails', async () => {
// TODO: remove once test failure has been fixed
if (isTurbo) return

const res = await fetchViaHTTP(appPort, '/to-nowhere', undefined, {
timeout: 5000,
})
Expand All @@ -363,9 +339,6 @@ const runTests = (isDev = false, isTurbo = false) => {
})

it('should provide params correctly for rewrite to auto-export non-dynamic page', async () => {
// TODO: remove once test failure has been fixed
if (isTurbo) return

const browser = await webdriver(
appPort,
'/rewriting-to-another-auto-export/first'
Expand All @@ -391,9 +364,6 @@ const runTests = (isDev = false, isTurbo = false) => {
})

it('should handle param like headers properly', async () => {
// TODO: remove once test failure has been fixed
if (isTurbo) return

const res = await fetchViaHTTP(appPort, '/my-other-header/my-path')
expect(res.headers.get('x-path')).toBe('my-path')
expect(res.headers.get('somemy-path')).toBe('hi')
Expand All @@ -412,9 +382,6 @@ const runTests = (isDev = false, isTurbo = false) => {
})

it('should not match dynamic route immediately after applying header', async () => {
// TODO: remove once test failure has been fixed
if (isTurbo) return

const res = await fetchViaHTTP(appPort, '/blog/post-321')
expect(res.headers.get('x-something')).toBe('applied-everywhere')

Expand Down Expand Up @@ -581,9 +548,6 @@ const runTests = (isDev = false, isTurbo = false) => {
})

it('should have correct encoding for params with catchall rewrite', async () => {
// TODO: remove once test failure has been fixed
if (isTurbo) return

const html = await renderViaHTTP(
appPort,
'/catchall-rewrite/hello%20world%3Fw%3D24%26focalpoint%3Dcenter?a=b'
Expand All @@ -606,9 +570,6 @@ const runTests = (isDev = false, isTurbo = false) => {
})

it('should have correct header for catchall rewrite', async () => {
// TODO: remove once test failure has been fixed
if (isTurbo) return

const res = await fetchViaHTTP(appPort, '/catchall-header/hello/world?a=b')
const headerValue = res.headers.get('x-value')
expect(headerValue).toBe('hello/world')
Expand All @@ -634,9 +595,6 @@ const runTests = (isDev = false, isTurbo = false) => {
})

it('should have correctly encoded params in query for redirect', async () => {
// TODO: remove once test failure has been fixed
if (isTurbo) return

const res = await fetchViaHTTP(
appPort,
'/query-redirect/hello%20world%3Fw%3D24%26focalpoint%3Dcenter/world?a=b',
Expand Down Expand Up @@ -744,9 +702,6 @@ const runTests = (isDev = false, isTurbo = false) => {
})

it('should work with rewrite when only specifying href', async () => {
// TODO: remove once test failure has been fixed
if (isTurbo) return

const browser = await webdriver(appPort, '/nav')
await browser.eval('window.beforeNav = 1')
await browser
Expand All @@ -763,9 +718,6 @@ const runTests = (isDev = false, isTurbo = false) => {
})

it('should work with rewrite when only specifying href and ends in dynamic route', async () => {
// TODO: remove once test failure has been fixed
if (isTurbo) return

const browser = await webdriver(appPort, '/nav')
await browser.eval('window.beforeNav = 1')
await browser
Expand Down Expand Up @@ -795,9 +747,6 @@ const runTests = (isDev = false, isTurbo = false) => {
})

it('should match /_next file after rewrite', async () => {
// TODO: remove once test failure has been fixed
if (isTurbo) return

await renderViaHTTP(appPort, '/hello')
const data = await renderViaHTTP(
appPort,
Expand All @@ -816,62 +765,41 @@ const runTests = (isDev = false, isTurbo = false) => {
})

it('should apply headers for exact match', async () => {
// TODO: remove once test failure has been fixed
if (isTurbo) return

const res = await fetchViaHTTP(appPort, '/add-header')
expect(res.headers.get('x-custom-header')).toBe('hello world')
expect(res.headers.get('x-another-header')).toBe('hello again')
})

it('should apply headers for multi match', async () => {
// TODO: remove once test failure has been fixed
if (isTurbo) return

const res = await fetchViaHTTP(appPort, '/my-headers/first')
expect(res.headers.get('x-first-header')).toBe('first')
expect(res.headers.get('x-second-header')).toBe('second')
})

it('should apply params for header key/values', async () => {
// TODO: remove once test failure has been fixed
if (isTurbo) return

const res = await fetchViaHTTP(appPort, '/my-other-header/first')
expect(res.headers.get('x-path')).toBe('first')
expect(res.headers.get('somefirst')).toBe('hi')
})

it('should support URL for header key/values', async () => {
// TODO: remove once test failure has been fixed
if (isTurbo) return

const res = await fetchViaHTTP(appPort, '/without-params/url')
expect(res.headers.get('x-origin')).toBe('https://example.com')
})

it('should apply params header key/values with URL', async () => {
// TODO: remove once test failure has been fixed
if (isTurbo) return

const res = await fetchViaHTTP(appPort, '/with-params/url/first')
expect(res.headers.get('x-url')).toBe('https://example.com/first')
})

it('should apply params header key/values with URL that has port', async () => {
// TODO: remove once test failure has been fixed
if (isTurbo) return

const res = await fetchViaHTTP(appPort, '/with-params/url2/first')
expect(res.headers.get('x-url')).toBe(
'https://example.com:8080?hello=first'
)
})

it('should support named pattern for header key/values', async () => {
// TODO: remove once test failure has been fixed
if (isTurbo) return

const res = await fetchViaHTTP(appPort, '/named-pattern/hello')
expect(res.headers.get('x-something')).toBe('value=hello')
expect(res.headers.get('path-hello')).toBe('end')
Expand Down Expand Up @@ -934,9 +862,6 @@ const runTests = (isDev = false, isTurbo = false) => {
})

it('should have correctly encoded query in location and refresh headers', async () => {
// TODO: remove once test failure has been fixed
if (isTurbo) return

const res = await fetchViaHTTP(
appPort,
// Query unencoded is ?テスト=あ
Expand Down Expand Up @@ -976,9 +901,6 @@ const runTests = (isDev = false, isTurbo = false) => {
})

it('should handle encoded value in the pathname correctly', async () => {
// TODO: remove once test failure has been fixed
if (isTurbo) return

const res = await fetchViaHTTP(
appPort,
'/redirect/me/to-about/' + encodeURI('\\google.com'),
Expand Down Expand Up @@ -1054,9 +976,6 @@ const runTests = (isDev = false, isTurbo = false) => {
})

it('should match missing header headers correctly', async () => {
// TODO: remove once test failure has been fixed
if (isTurbo) return

const res = await fetchViaHTTP(appPort, '/missing-headers-1', undefined, {
headers: {
'x-my-header': 'hello world!!',
Expand All @@ -1072,9 +991,6 @@ const runTests = (isDev = false, isTurbo = false) => {
})

it('should match missing query headers correctly', async () => {
// TODO: remove once test failure has been fixed
if (isTurbo) return

const res = await fetchViaHTTP(appPort, '/missing-headers-2', {
'my-query': 'hellooo',
})
Expand All @@ -1088,9 +1004,6 @@ const runTests = (isDev = false, isTurbo = false) => {
})

it('should match missing cookie headers correctly', async () => {
// TODO: remove once test failure has been fixed
if (isTurbo) return

const res = await fetchViaHTTP(appPort, '/missing-headers-3', undefined, {
headers: {
cookie: 'loggedIn=true',
Expand Down Expand Up @@ -1327,9 +1240,6 @@ const runTests = (isDev = false, isTurbo = false) => {
})

it('should match has rewrite correctly before files', async () => {
// TODO: remove once test failure has been fixed
if (isTurbo) return

const res1 = await fetchViaHTTP(appPort, '/hello')
expect(res1.status).toBe(200)
const $1 = cheerio.load(await res1.text())
Expand Down Expand Up @@ -1497,9 +1407,6 @@ const runTests = (isDev = false, isTurbo = false) => {
})

it('should match has header for header correctly', async () => {
// TODO: remove once test failure has been fixed
if (isTurbo) return

const res = await fetchViaHTTP(appPort, '/has-header-1', undefined, {
headers: {
'x-my-header': 'hello world!!',
Expand All @@ -1516,9 +1423,6 @@ const runTests = (isDev = false, isTurbo = false) => {
})

it('should match has query for header correctly', async () => {
// TODO: remove once test failure has been fixed
if (isTurbo) return

const res = await fetchViaHTTP(
appPort,
'/has-header-2',
Expand All @@ -1539,9 +1443,6 @@ const runTests = (isDev = false, isTurbo = false) => {
})

it('should match has cookie for header correctly', async () => {
// TODO: remove once test failure has been fixed
if (isTurbo) return

const res = await fetchViaHTTP(appPort, '/has-header-3', undefined, {
headers: {
cookie: 'loggedIn=true',
Expand All @@ -1558,9 +1459,6 @@ const runTests = (isDev = false, isTurbo = false) => {
})

it('should match has host for header correctly', async () => {
// TODO: remove once test failure has been fixed
if (isTurbo) return

const res = await fetchViaHTTP(appPort, '/has-header-4', undefined, {
headers: {
host: 'example.com',
Expand Down