Skip to content

Commit

Permalink
✅ fix i18n test failures
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnsonMao committed Oct 26, 2023
1 parent 7dc494b commit 33c531e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/components/Link/link.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ describe('Link component', () => {
it.each([
['/internal', '/internal'],
['/en/internal', '/en/internal'],
['/zh-TW/internal', '/zh-TW/internal'],
['/fr-CH/internal', '/internal'],
['/zh/internal', '/zh/internal'],
['/fr/internal', '/internal'],
])(
'should render correct link element with pathname %s',
(pathname, expected) => {
Expand Down
6 changes: 3 additions & 3 deletions src/hooks/__tests__/useI18n.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ describe('useI18n hook', () => {
});

it.each([
['/test/path', 'zh-TW'],
['/test/path', 'zh'],
['/en/test/path', 'en'],
['/zh-TW/test/path', 'zh-TW'],
['/fr-CH/test/path', 'zh-TW'],
['/zh/test/path', 'zh'],
['/fr/test/path', 'zh'],
])(
'should return the correct language code and dictionary',
(pathname, expected) => {
Expand Down
10 changes: 5 additions & 5 deletions src/utils/__tests__/getLocale.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ describe('get locale function', () => {
});

it.each([
['zh-TW,zh;q=0.9,en-US;q=0.8,en;q=0.7', 'zh-TW'],
['zh-TW,zh;q=0.9,en-US;q=0.8,en;q=0.7', 'zh'],
['en-US,en;q=0.9,zh-TW;q=0.8,ja;q=0.7', 'en'],
['fr-CH,fr;q=0.9,de-CH;q=0.8,de;q=0.7', 'zh-TW'],
['fr-CH,fr;q=0.9,de-CH;q=0.8,de;q=0.7', 'zh'],
])(
'should extract the preferred language code from the Accept-Language header',
(acceptLanguage, expected) => {
Expand All @@ -19,10 +19,10 @@ describe('get locale function', () => {
);

it.each([
['/test/path', 'zh-TW'],
['/test/path', 'zh'],
['/en/test/path', 'en'],
['/zh-TW/test/path', 'zh-TW'],
['/fr-CH/test/path', 'zh-TW'],
['/zh/test/path', 'zh'],
['/fr/test/path', 'zh'],
])(
'should extract the language code from the path string',
(pathname, expected) => {
Expand Down

0 comments on commit 33c531e

Please sign in to comment.