test: input number separator test (#4204)

This commit is contained in:
katherinehhh 2024-04-28 11:17:43 +08:00 committed by GitHub
parent fb41cce7b1
commit 132f626fa3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -89,6 +89,15 @@ describe('ReadPretty:formatNumberWithSeparator', () => {
const formatted = formatNumberWithSeparator(1234567.89, '0,0.00', 1); const formatted = formatNumberWithSeparator(1234567.89, '0,0.00', 1);
expect(formatted).toBe('1,234,567.9'); expect(formatted).toBe('1,234,567.9');
}); });
test('Format number with custom 0 0,00 separator', () => {
const formatted = formatNumberWithSeparator(1234567.89, '0 0,00', 1);
expect(formatted).toBe('1 234 567.9');
});
test('Format number with custom 0.00 separator', () => {
const formatted = formatNumberWithSeparator(1234567.89, '0.00', 1);
expect(formatted).toBe('1234567.9');
});
}); });
describe('ReadPretty:formatUnitConversion', () => { describe('ReadPretty:formatUnitConversion', () => {
// Test case 1: Multiply a value by 2 // Test case 1: Multiply a value by 2