|
1 | 1 | import { describe, it, expect } from 'vitest';
|
2 | 2 |
|
3 | 3 | import { clamp, formatNumber, formatNumberWithLocale, round } from './number';
|
4 |
| -import { knownLocales } from './locale'; |
| 4 | +import { createLocaleSettings, knownLocales } from './locale'; |
5 | 5 |
|
6 | 6 | describe('clamp()', () => {
|
7 | 7 | it('no change', () => {
|
@@ -61,17 +61,21 @@ describe('formatNumber()', () => {
|
61 | 61 | });
|
62 | 62 |
|
63 | 63 | it('returns value as string for style "none"', () => {
|
64 |
| - const actual = formatNumber(1234.5678, { style: 'none' }); |
| 64 | + const actual = formatNumber(1234.5678, 'none'); |
65 | 65 | expect(actual).equal('1234.5678');
|
66 | 66 | });
|
67 | 67 |
|
68 | 68 | it('formats number with integer default', () => {
|
69 |
| - const actual = formatNumber(1234.5678, { style: 'integer' }); |
| 69 | + const actual = formatNumber(1234.5678, 'integer'); |
70 | 70 | expect(actual).equal('1,235');
|
71 | 71 | });
|
72 | 72 |
|
73 | 73 | it('formats number with integer fr', () => {
|
74 |
| - const actual = formatNumber(1234.5678, { style: 'integer', locales: 'fr' }); |
| 74 | + const actual = formatNumberWithLocale( |
| 75 | + createLocaleSettings({ locale: 'fr' }), |
| 76 | + 1234.5678, |
| 77 | + 'integer' |
| 78 | + ); |
75 | 79 | expect(actual).equal('1 235');
|
76 | 80 | });
|
77 | 81 |
|
|
0 commit comments