Skip to content

Commit

Permalink
Add fallbackLocale tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jarda-svoboda committed May 1, 2022
1 parent 9577105 commit da65a49
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/specs/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,17 @@ describe('i18n instance', () => {
);
});
});
it('`fallbackLocale` is used instead of unknown locale.', async () => {
const fallbackLocale = loaders.find(({ locale }) => locale.toLowerCase() !== initLocale?.toLowerCase())?.locale;

const { locale, loadTranslations } = new i18n({ loaders, fallbackLocale });

await loadTranslations('de', '');

const $locale = locale.get();

expect($locale).toBe(fallbackLocale);
});
it('includes `translations` only for loaders without routes', async () => {
const { translations, loadConfig } = new i18n();

Expand Down

0 comments on commit da65a49

Please sign in to comment.