Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
adrai committed Dec 12, 2022
1 parent 0d5bd6e commit 3dd9aa8
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 39 deletions.
48 changes: 24 additions & 24 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"url": "https://github.com/i18next/react-i18next.git"
},
"dependencies": {
"@babel/runtime": "^7.14.5",
"@babel/runtime": "^7.20.6",
"html-parse-stringify": "^3.0.1"
},
"devDependencies": {
Expand Down Expand Up @@ -78,7 +78,7 @@
"eslint-plugin-react": "^7.16.0",
"eslint-plugin-testing-library": "^3.10.1",
"husky": "^3.0.3",
"i18next": "^22.0.1",
"i18next": "^22.4.2",
"jest": "^24.8.0",
"jest-cli": "^24.8.4",
"lint-staged": "^8.1.3",
Expand Down
5 changes: 0 additions & 5 deletions test/typescript/custom-types/Translation.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,6 @@ function expectErrorWhenKeyNotInNamespace() {
return <Translation ns="custom">{(t) => <>{t('fake')}</>}</Translation>;
}

function expectErrorWhenUsingArrayNamespaceAndUnscopedKey() {
// @ts-expect-error
return <Translation ns={['custom']}>{(t) => <>{t('foo')}</>}</Translation>;
}

function expectErrorWhenUsingArrayNamespaceAndWrongKey() {
// @ts-expect-error
return <Translation ns={['custom']}>{(t) => <>{t('custom:fake')}</>}</Translation>;
Expand Down
16 changes: 8 additions & 8 deletions test/typescript/custom-types/useTranslation.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ function arrayNamespace() {
return (
<>
{t('alternate:baz')}
{t('baz', { ns: 'alternate' })}
{t('custom:foo')}
{t('foo', { ns: 'custom' })}
</>
);
}
Expand All @@ -33,7 +35,9 @@ function readonlyArrayNamespace() {
return (
<>
{t('alternate:baz')}
{t('baz', { ns: 'alternate' })}
{t('custom:foo')}
{t('foo', { ns: 'custom' })}
</>
);
}
Expand All @@ -47,7 +51,7 @@ function deepKeyPrefixOption() {
const [t] = useTranslation('alternate', { keyPrefix: 'foobar.deep' });
return (
<>
{t('deeper').deeeeeper}
{t('deeper', { returnObjects: true }).deeeeeper}
{t('deeper.deeeeeper')}
</>
);
Expand Down Expand Up @@ -75,16 +79,12 @@ function expectErrorWhenKeyNotInNamespace() {
return <>{t('fake')}</>;
}

function expectErrorWhenUsingArrayNamespaceAndUnscopedKey() {
const [t] = useTranslation(['custom']);
// @ts-expect-error
return <>{t('foo')}</>;
}

function expectErrorWhenUsingArrayNamespaceAndWrongKey() {
const [t] = useTranslation(['custom']);
// @ts-expect-error
return <>{t('custom:fake')}</>;
<>{t('custom:fake')}</>;
// @ts-expect-error
return <>{t('fake', { ns: 'custom' })}</>;
}

function expectErrorWhenUsingWrongKeyPrefixOption() {
Expand Down

0 comments on commit 3dd9aa8

Please sign in to comment.