@yoroi/common
Version:
The Common package of Yoroi SDK
24 lines (23 loc) • 814 B
JavaScript
;
var _atomicFormatter = require("./atomic-formatter");
describe('atomicFormatter', () => {
// NOTE: decimal and thousands separators are locale-dependent
it.each`
value | decimalPlaces | expected
${BigInt(1234567890)} | ${2} | ${'12,345,678.90'}
${BigInt(189)} | ${6} | ${'0.000189'}
${BigInt(1000000)} | ${6} | ${'1.000000'}
${BigInt(1000000)} | ${0} | ${'1,000,000'}
`('formats value $value with $decimalPlaces decimal places to $expected', ({
value,
decimalPlaces,
expected
}) => {
const formattedValue = (0, _atomicFormatter.atomicFormatter)({
value,
decimalPlaces
});
expect(formattedValue).toBe(expected);
});
});
//# sourceMappingURL=atomic-formatter.test.js.map