Files
BeWoPlaner/BeWoPlanerMobil/node_modules/cldr/test/extractNumberingSystem.js

51 lines
1.5 KiB
JavaScript
Raw Normal View History

const expect = require('unexpected');
const cldr = require('../lib/cldr');
describe('extractNumberingSystem', () => {
it('should throw if the numbering system does not exist', () => {
expect(
() => cldr.extractNumberingSystem('foo'),
'to error',
'Unknown numbering system: foo'
);
});
it('should extract a numeric (digits-based) numbering system', () => {
expect(cldr.extractNumberingSystem('fullwide'), 'to equal', {
type: 'numeric',
digits: ['', '', '', '', '', '', '', '', '', ''],
});
});
it('should extract digits with high codepoints', () => {
expect(cldr.extractNumberingSystem('ahom'), 'to equal', {
type: 'numeric',
digits: ['𑜰', '𑜱', '𑜲', '𑜳', '𑜴', '𑜵', '𑜶', '𑜷', '𑜸', '𑜹'],
});
});
it('should extract an algorithmic numbering system without a locale', () => {
expect(cldr.extractNumberingSystem('ethi'), 'to equal', {
type: 'algorithmic',
rules: 'renderEthiopic',
});
});
it('should extract an algorithmic numbering system with a locale', () => {
expect(cldr.extractNumberingSystem('jpan'), 'to equal', {
type: 'algorithmic',
rules: 'renderSpelloutCardinal',
locale: 'ja',
});
});
it('should extract an algorithmic numbering system with a locale and a sublocale', () => {
expect(cldr.extractNumberingSystem('hantfin'), 'to equal', {
type: 'algorithmic',
rules: 'renderSpelloutCardinalFinancial',
locale: 'zh_Hant',
});
});
});