Skip to content

Commit c4062ab

Browse files
author
Tiffany Le-Nguyen
committed
chore: add locale test
1 parent 275be49 commit c4062ab

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

.eslintrc.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ module.exports = {
4242
'max-nested-callbacks': 0,
4343
'promise/prefer-await-to-then': 0,
4444
'promise/always-return': 0,
45-
'promise/catch-or-return': 0
45+
'promise/catch-or-return': 0,
4646
},
47-
}
47+
},
4848
],
4949
}

cypress/integration/i18n.spec.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,28 @@ describe('Localization', () => {
1111
it('should use the NEXT_LOCALE cookie to determine the default locale', () => {
1212
cy.setCookie('NEXT_LOCALE', 'fr')
1313
cy.visit('/');
14+
15+
cy.findByText('The current locale is fr')
16+
})
17+
18+
it('should use the NEXT_LOCALE cookie over Accept-Language header to determine the default locale', () => {
19+
// cy.setCookie('NEXT_LOCALE', 'en')
20+
cy.visit({
21+
url: '/',
22+
headers: {
23+
'Accept-Language': 'fr;q=0.9'
24+
}
25+
});
1426
cy.findByText('The current locale is fr')
27+
28+
cy.setCookie('NEXT_LOCALE', 'en')
29+
cy.visit({
30+
url: '/',
31+
headers: {
32+
'Accept-Language': 'fr;q=0.9'
33+
}
34+
});
35+
36+
cy.findByText('The current locale is en')
1537
})
1638
})

0 commit comments

Comments
 (0)