chore: strengthen backend eslint profile
This commit is contained in:
@@ -21,3 +21,18 @@ describe('decimal', () => {
|
||||
).toBe('1');
|
||||
});
|
||||
});
|
||||
|
||||
describe('decimal formatting', () => {
|
||||
it.each([
|
||||
[120000n, 4, '12'],
|
||||
[-120030n, 4, '-12.003'],
|
||||
[1n, 4, '0.0001'],
|
||||
[0n, 4, '0'],
|
||||
])('preserves value %s at scale %s while trimming only trailing zeros', (value, scale, expected) => {
|
||||
expect(formatDecimal({ value, scale })).toBe(expected);
|
||||
});
|
||||
it('preserves a long fraction with a trailing zero run', () => {
|
||||
const significant = '1'.repeat(10_000);
|
||||
expect(formatDecimal({ value: BigInt(significant + '0'.repeat(10_000)), scale: 20_000 })).toBe('0.' + significant);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user