Skip to content

Commit

Permalink
vercel#42398 test(production): check link to non iso route
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcus-Rise committed Nov 8, 2022
1 parent 984627a commit 268c230
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/production/app-dir-prefetch-non-iso-url/app/[slug]/page.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export default function Slug(props) {
return (
<>
<p id="page">/[slug]</p>
<p id="props">{JSON.stringify(props)}</p>
</>
)
}

export function generateStaticParams() {
return [{ slug: 'iso-url' }, { slug: 'кириллица' }]
}
7 changes: 7 additions & 0 deletions test/production/app-dir-prefetch-non-iso-url/app/layout.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default function Layout({ children }) {
return (
<html>
<body>{children}</body>
</html>
)
}
18 changes: 18 additions & 0 deletions test/production/app-dir-prefetch-non-iso-url/app/page.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import Link from 'next/link'

export default function Page(props) {
return (
<>
<p id="page">index</p>
<p id="props">{JSON.stringify(props)}</p>
<Link href="/iso-url" id="to-iso">
/iso-url
</Link>
<br />
<Link href="/кириллица" id="to-non-iso">
/кириллица
</Link>
<br />
</>
)
}
37 changes: 37 additions & 0 deletions test/production/app-dir-prefetch-non-iso-url/index.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { createNext, FileRef } from 'e2e-utils'
import { NextInstance } from 'test/lib/next-modes/base'
import { join } from 'path'
import { BrowserInterface } from '../../lib/browsers/base'
import webdriver from 'next-webdriver'
import { waitFor } from 'next-test-utils'

describe('app-dir-prefetch-non-iso-url', () => {
let next: NextInstance

beforeAll(async () => {
next = await createNext({
files: {
'next.config.js': new FileRef(join(__dirname, 'next.config.js')),
app: new FileRef(join(__dirname, 'app')),
},
})
})
afterAll(() => next.destroy())

it('should go to non-iso url', async () => {
let browser: BrowserInterface

try {
browser = await webdriver(next.appPort, '/')
await browser.elementByCss('#to-non-iso').click()

await waitFor(3000)

expect(browser.elementByCss('#page')).toBe('/[slug]')
} finally {
if (browser) {
await browser.close()
}
}
})
})
6 changes: 6 additions & 0 deletions test/production/app-dir-prefetch-non-iso-url/next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/** @type {import("next").NextConfig} */
const nextConfig = {
experimental: { appDir: true },
}

module.exports = nextConfig

0 comments on commit 268c230

Please sign in to comment.