mirror of
https://github.com/strapi/strapi.git
synced 2025-08-03 14:28:40 +00:00
27 lines
712 B
JavaScript
27 lines
712 B
JavaScript
![]() |
'use strict';
|
||
|
|
||
|
const { getInitLocale } = require('../');
|
||
|
|
||
|
describe('I18N default locale', () => {
|
||
|
describe('getInitLocale', () => {
|
||
|
test('The init locale is english by default', () => {
|
||
|
expect(getInitLocale()).toEqual({
|
||
|
code: 'en',
|
||
|
name: 'English (en)',
|
||
|
});
|
||
|
});
|
||
|
|
||
|
test('The init locale can be configured by an env var', () => {
|
||
|
process.env.STRAPI_PLUGIN_I18N_INIT_LOCALE_CODE = 'fr';
|
||
|
expect(getInitLocale()).toMatchObject({
|
||
|
code: 'fr',
|
||
|
});
|
||
|
});
|
||
|
|
||
|
test('Throws if env var code is unknown in iso list', () => {
|
||
|
process.env.STRAPI_PLUGIN_I18N_INIT_LOCALE_CODE = 'zzzzz';
|
||
|
expect(() => getInitLocale()).toThrow();
|
||
|
});
|
||
|
});
|
||
|
});
|