Shortened the table's "Values" with k, m and bn suffixes
This commit is contained in:
1 parent
3bb2711276
commit
7543d85de4
3 files changed
+40
-2
No files matched your search
@@ -5,6 +5,7 @@ import {
|
||||
formatDate,
|
||||
formatDateTime,
|
||||
formatMoney,
|
||||
formatMoneyShort,
|
||||
formatValue,
|
||||
parseDate,
|
||||
} from './format';
|
||||
@@ -34,6 +35,21 @@ test('money is shown in whole pounds, and nothing as a dash', () => {
|
||||
expect(formatMoney(-5)).toBe('—');
|
||||
});
|
||||
|
||||
test.each([
|
||||
{ value: 1, want: '£1' },
|
||||
{ value: 500, want: '£500' },
|
||||
{ value: 3563, want: '£3.6k' },
|
||||
{ value: 12500, want: '£13k' },
|
||||
{ value: 583333, want: '£583k' },
|
||||
{ value: 1500000, want: '£1.5m' },
|
||||
{ value: 9621987, want: '£9.6m' },
|
||||
{ value: 36250000000, want: '£36bn' },
|
||||
{ value: 0, want: '—' },
|
||||
{ value: -5, want: '—' },
|
||||
])('formatMoneyShort shows $value as $want', ({ value, want }) => {
|
||||
expect(formatMoneyShort(value)).toBe(want);
|
||||
});
|
||||
|
||||
test('formatCount groups thousands', () => {
|
||||
expect(formatCount(4854)).toBe('4,854');
|
||||
expect(formatCount(7)).toBe('7');
|
||||
|
||||
Reference in new issue
Block a user