Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ijjk committed Oct 14, 2020
1 parent f929cc6 commit d0d75d4
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/next/build/index.ts
Expand Up @@ -334,7 +334,7 @@ export default async function build(
}
}),
dataRoutes: [],
i18n: config.experimental.i18n,
i18n: config.experimental.i18n || undefined,
}

await promises.mkdir(distDir, { recursive: true })
Expand Down
25 changes: 25 additions & 0 deletions test/integration/i18n-support/test/index.test.js
Expand Up @@ -27,6 +27,31 @@ let appPort
const locales = ['en-US', 'nl-NL', 'nl-BE', 'nl', 'fr-BE', 'fr', 'en']

function runTests(isDev) {
if (!isDev) {
it('should add i18n config to routes-manifest', async () => {
const routesManifest = await fs.readJSON(
join(appDir, '.next/routes-manifest.json')
)

expect(routesManifest.i18n).toEqual({
locales: ['en-US', 'nl-NL', 'nl-BE', 'nl', 'fr-BE', 'fr', 'en'],
defaultLocale: 'en-US',
domains: [
{
http: true,
domain: 'example.be',
defaultLocale: 'nl-BE',
},
{
http: true,
domain: 'example.fr',
defaultLocale: 'fr',
},
],
})
})
}

it('should update asPath on the client correctly', async () => {
for (const check of ['en', 'En']) {
const browser = await webdriver(appPort, `/${check}`)
Expand Down

0 comments on commit d0d75d4

Please sign in to comment.