intl-locales-supported
Version:
Utility to help you polyfill the Node.js runtime when the Intl APIs are missing, or if the built-in Intl is missing locale data that you need.
37 lines (28 loc) • 902 B
text/typescript
import areIntlLocalesSupported from '../src';
import { expect as chaiExpect } from 'chai';
declare var expect: typeof chaiExpect;
describe('exports', function() {
it('should have a default export function', function() {
expect(areIntlLocalesSupported).to.be.a('function');
});
});
describe('areIntlLocalesSupported()', function() {
const Intl = global.Intl;
describe('missing Intl', function() {
beforeEach(function() {
global.Intl = undefined as any;
});
afterEach(function() {
global.Intl = Intl;
});
it('should return `false` for "en"', function() {
expect(areIntlLocalesSupported('en')).to.be.false;
});
});
it('should return `true` for "en"', function() {
expect(areIntlLocalesSupported('en')).to.be.true;
});
it('should return `true` for "fr"', function() {
expect(areIntlLocalesSupported('fr')).to.be.true;
});
});