Changeset View
Changeset View
Standalone View
Standalone View
web/cashtab/src/utils/__tests__/cashMethods.test.js
Show All 22 Lines | describe('Correctly executes cash utility functions', () => { | ||||
it(`Formats a large number with 2 decimal places to add as thousands separator`, () => { | it(`Formats a large number with 2 decimal places to add as thousands separator`, () => { | ||||
expect(formatBalance(10000000123456.78)).toBe('10 000 000 123 456.78'); | expect(formatBalance(10000000123456.78)).toBe('10 000 000 123 456.78'); | ||||
}); | }); | ||||
it(`Formats a large number with 9 decimal places to add as thousands separator without adding them to decimals`, () => { | it(`Formats a large number with 9 decimal places to add as thousands separator without adding them to decimals`, () => { | ||||
expect(formatBalance('10000000123456.789123456')).toBe( | expect(formatBalance('10000000123456.789123456')).toBe( | ||||
'10 000 000 123 456.789123456', | '10 000 000 123 456.789123456', | ||||
); | ); | ||||
}); | }); | ||||
it(`formatBalance handles an input of 0`, () => { | |||||
expect(formatBalance('0')).toBe('0'); | |||||
}); | |||||
it(`formatBalance handles an input of undefined`, () => { | |||||
expect(formatBalance(undefined)).toBe(undefined); | |||||
}); | |||||
it(`formatBalance handles an input of null`, () => { | |||||
expect(formatBalance(null)).toBe(null); | |||||
}); | |||||
}); | }); |