Skip to content

Commit 9542deb

Browse files
committed
Add playwright tests for redirecting invalid cased locales
1 parent 709327c commit 9542deb

File tree

1 file changed

+34
-1
lines changed

1 file changed

+34
-1
lines changed

examples/example-app-router-playground/tests/main.spec.ts

+34-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ it('redirects to a matched locale at the root for non-default locales', async ({
5757
page.getByRole('heading', {name: 'Start'});
5858
});
5959

60-
it('redirects to a matched locale for invalid cased locales', async ({
60+
it('redirects to a matched locale for an invalid cased non-default locale', async ({
6161
browser
6262
}) => {
6363
const context = await browser.newContext({locale: 'de'});
@@ -68,6 +68,39 @@ it('redirects to a matched locale for invalid cased locales', async ({
6868
page.getByRole('heading', {name: 'Start'});
6969
});
7070

71+
it('redirects to a matched locale for an invalid cased non-default locale in a nested path', async ({
72+
browser
73+
}) => {
74+
const context = await browser.newContext({locale: 'de'});
75+
const page = await context.newPage();
76+
77+
await page.goto('/DE/verschachtelt');
78+
await expect(page).toHaveURL('/de/verschachtelt');
79+
page.getByRole('heading', {name: 'Verschachtelt'});
80+
});
81+
82+
it('redirects to a matched locale for an invalid cased default locale', async ({
83+
browser
84+
}) => {
85+
const context = await browser.newContext({locale: 'en'});
86+
const page = await context.newPage();
87+
88+
await page.goto('/EN');
89+
await expect(page).toHaveURL('/');
90+
page.getByRole('heading', {name: 'Home'});
91+
});
92+
93+
it('redirects to a matched locale for an invalid cased default locale in a nested path', async ({
94+
browser
95+
}) => {
96+
const context = await browser.newContext({locale: 'en'});
97+
const page = await context.newPage();
98+
99+
await page.goto('/EN/nested');
100+
await expect(page).toHaveURL('/nested');
101+
page.getByRole('heading', {name: 'Nested'});
102+
});
103+
71104
it('redirects a prefixed pathname for the default locale to the unprefixed version', async ({
72105
request
73106
}) => {

0 commit comments

Comments
 (0)