2016-09-13 17:27:01 +03:00
|
|
|
import { currencyDisplay, currencyDisplays, territoryCurrencyCode } from '../src/cldr';
|
2016-09-14 19:18:38 +03:00
|
|
|
import { errors } from '../src/errors';
|
2016-09-13 14:06:26 +03:00
|
|
|
|
|
|
|
describe('currencyDisplay', () => {
|
|
|
|
it('should throw an exception when locale is not available', () => {
|
2016-09-14 19:18:38 +03:00
|
|
|
expect(() => {
|
2016-09-13 14:06:26 +03:00
|
|
|
currencyDisplay('de', {
|
|
|
|
currency: 'USD'
|
|
|
|
});
|
2016-09-17 12:51:36 +03:00
|
|
|
}).toThrowError(new RegExp(errors.NoLocale.name));
|
2016-09-13 14:06:26 +03:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2016-09-13 17:27:01 +03:00
|
|
|
describe('currencyDisplays', () => {
|
|
|
|
it('should throw an exception when currency display is not available', () => {
|
2016-09-14 19:18:38 +03:00
|
|
|
expect(() => {
|
2016-09-13 17:27:01 +03:00
|
|
|
currencyDisplays('en', {
|
|
|
|
currency: 'GBP'
|
|
|
|
});
|
2016-09-17 12:51:36 +03:00
|
|
|
}).toThrowError(new RegExp(errors.NoCurrencyDisplay.name));
|
2016-09-13 17:27:01 +03:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2016-09-13 14:06:26 +03:00
|
|
|
describe('territoryCurrencyCode', () => {
|
|
|
|
it('should throw an exception when no region currencies info', () => {
|
2016-09-14 19:18:38 +03:00
|
|
|
expect(() => {
|
2016-09-13 14:06:26 +03:00
|
|
|
territoryCurrencyCode('en');
|
2016-09-17 12:51:36 +03:00
|
|
|
}).toThrowError(new RegExp(errors.NoCurrencyRegion.name));
|
2016-09-13 14:06:26 +03:00
|
|
|
});
|
|
|
|
});
|