Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('should handle currency/locale pairs with decimal period and thousands comma separators', () => {
const currency = 'USD';
const locale = 'en-US';
const expectedDecimalSymbol = '.';
const expectedThousandsSeparatorSymbol = ',';
createCurrencyMask(currency, locale);
const options = createNumberMask.mock.calls[0][0];
const actualDecimalSymbol = options.decimalSymbol;
const actualThousandsSeparatorSymbol = options.thousandsSeparatorSymbol;
expect(actualDecimalSymbol).toEqual(expectedDecimalSymbol);
expect(actualThousandsSeparatorSymbol).toEqual(
expectedThousandsSeparatorSymbol
);
});
it('should handle currency/locale pairs with no fractional part', () => {
const currency = 'CLP';
const locale = 'es-CL';
const expectedAllowDecimal = false;
const expectedDecimalLimit = 0;
createCurrencyMask(currency, locale);
const options = createNumberMask.mock.calls[0][0];
const actualAllowDecimal = options.allowDecimal;
const actualDecimalLimit = options.decimalLimit;
expect(actualAllowDecimal).toEqual(expectedAllowDecimal);
expect(actualDecimalLimit).toEqual(expectedDecimalLimit);
});