languageUtils.spec.js (i18next-22.4.11) | : | languageUtils.spec.js (i18next-22.4.12) | ||
---|---|---|---|---|
skipping to change at line 327 | skipping to change at line 327 | |||
{ args: [['ru']], expected: 'en' }, | { args: [['ru']], expected: 'en' }, | |||
{ args: [[]], expected: 'en' }, | { args: [[]], expected: 'en' }, | |||
]; | ]; | |||
tests.forEach((test) => { | tests.forEach((test) => { | |||
it('correctly get best match for ' + JSON.stringify(test.args) + ' args', () => { | it('correctly get best match for ' + JSON.stringify(test.args) + ' args', () => { | |||
expect(cu.getBestMatchFromCodes.apply(cu, test.args)).to.eql(test.expect ed); | expect(cu.getBestMatchFromCodes.apply(cu, test.args)).to.eql(test.expect ed); | |||
}); | }); | |||
}); | }); | |||
}); | }); | |||
describe('getBestMatchFromCodes() with dev', () => { | ||||
var cu; | ||||
before(() => { | ||||
cu = new LanguageUtils({ | ||||
fallbackLng: ['fr'], | ||||
supportedLngs: ['dev', 'en', 'fr'], | ||||
}); | ||||
}); | ||||
var tests = [ | ||||
{ args: [['de']], expected: 'fr' }, | ||||
{ args: [['ru', 'en']], expected: 'en' }, | ||||
{ args: [['en-GB']], expected: 'en' }, | ||||
{ args: [['ru', 'en-GB']], expected: 'en' }, | ||||
{ args: [['de-CH']], expected: 'fr' }, | ||||
{ args: [['ru']], expected: 'fr' }, | ||||
{ args: [[]], expected: 'fr' }, | ||||
]; | ||||
tests.forEach((test) => { | ||||
it('correctly get best match for ' + JSON.stringify(test.args) + ' args', | ||||
() => { | ||||
expect(cu.getBestMatchFromCodes.apply(cu, test.args)).to.eql(test.expect | ||||
ed); | ||||
}); | ||||
}); | ||||
}); | ||||
describe('getBestMatchFromCodes() with dev and nonExplicitSupportedLngs: true' | ||||
, () => { | ||||
var cu; | ||||
before(() => { | ||||
cu = new LanguageUtils({ | ||||
fallbackLng: ['fr'], | ||||
supportedLngs: ['dev', 'en', 'fr'], | ||||
nonExplicitSupportedLngs: true, | ||||
}); | ||||
}); | ||||
var tests = [ | ||||
{ args: [['de']], expected: 'fr' }, | ||||
{ args: [['ru', 'en']], expected: 'en' }, | ||||
{ args: [['en-GB']], expected: 'en-GB' }, | ||||
{ args: [['ru', 'en-GB']], expected: 'en-GB' }, | ||||
{ args: [['de-CH']], expected: 'fr' }, | ||||
{ args: [['ru']], expected: 'fr' }, | ||||
{ args: [[]], expected: 'fr' }, | ||||
]; | ||||
tests.forEach((test) => { | ||||
it('correctly get best match for ' + JSON.stringify(test.args) + ' args', | ||||
() => { | ||||
expect(cu.getBestMatchFromCodes.apply(cu, test.args)).to.eql(test.expect | ||||
ed); | ||||
}); | ||||
}); | ||||
}); | ||||
}); | }); | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 60 lines changed or added |