frequi_origin/tests/unit/formatters.spec.ts
2022-01-01 17:23:29 +01:00

14 lines
513 B
TypeScript

import { formatPercent, formatPriceCurrency } from '@/shared/formatters';
describe('formatters.ts', () => {
it('Format percent correctly', () => {
expect(formatPercent(0.5)).toEqual('50.000%');
});
it('format price currency as expected', () => {
expect(formatPriceCurrency(5123.551123, 'USDT', 3)).toEqual('5123.551 USDT');
expect(formatPriceCurrency(5123.551123, 'USDT')).toEqual('5123.551 USDT');
expect(formatPriceCurrency(5123.551123, 'USDT', 5)).toEqual('5123.55112 USDT');
});
});