Skip to content

Commit

Permalink
Update flakey tests a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
ijjk committed Feb 8, 2022
1 parent fb80055 commit a7d3e84
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 deletions.
31 changes: 18 additions & 13 deletions test/integration/custom-routes/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,6 @@ let appPort
let app

const runTests = (isDev = false) => {
it('should handle external beforeFiles rewrite correctly', async () => {
const res = await fetchViaHTTP(appPort, '/overridden')
expect(res.status).toBe(200)
expect(await res.text()).toContain('Example Domain')

const browser = await webdriver(appPort, '/nav')
await browser.elementByCss('#to-before-files-overridden').click()
await check(
() => browser.eval('document.documentElement.innerHTML'),
/Example Domain/
)
})

it('should handle has query encoding correctly', async () => {
for (const expected of [
{
Expand Down Expand Up @@ -94,6 +81,24 @@ const runTests = (isDev = false) => {
}
})

it('should handle external beforeFiles rewrite correctly', async () => {
const res = await fetchViaHTTP(appPort, '/overridden')
const html = await res.text()

if (res.status !== 200) {
console.error('Invalid response', html)
}
expect(res.status).toBe(200)
expect(html).toContain('Example Domain')

const browser = await webdriver(appPort, '/nav')
await browser.elementByCss('#to-before-files-overridden').click()
await check(
() => browser.eval('document.documentElement.innerHTML'),
/Example Domain/
)
})

it('should support long URLs for rewrites', async () => {
const res = await fetchViaHTTP(
appPort,
Expand Down
4 changes: 2 additions & 2 deletions test/integration/middleware/core/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ function rewriteTests(log, locale = '') {
it('should override with rewrite internally correctly', async () => {
const res = await fetchViaHTTP(
context.appPort,
'/rewrites/about',
`${locale}/rewrites/about`,
{ override: 'internal' },
{ redirect: 'manual' }
)
Expand All @@ -190,7 +190,7 @@ function rewriteTests(log, locale = '') {
it('should override with rewrite externally correctly', async () => {
const res = await fetchViaHTTP(
context.appPort,
'/rewrites/about',
`${locale}/rewrites/about`,
{ override: 'external' },
{ redirect: 'manual' }
)
Expand Down

0 comments on commit a7d3e84

Please sign in to comment.