|
1 | 1 | import { describe, expect, test } from 'vitest'; |
2 | | -import { formatOrganizationNumber, formatPhoneNumber } from '.'; |
| 2 | +import { formatOrganizationNumber as formatOrganizationNumberNo } from './no'; |
| 3 | +import { formatOrganizationNumber as formatOrganizationNumberSe } from './se'; |
3 | 4 |
|
4 | 5 | describe('no', () => { |
5 | 6 | test.each([ |
6 | | - ['22865500', '22 86 55 00'], |
7 | | - ['80000000', '800 00 000'], |
8 | | - ])('formatPhoneNumber(%s) -> %s', (input, expected) => { |
9 | | - expect(formatPhoneNumber(input, 'no')).toBe(expected); |
| 7 | + ['000000000', '000 000 000'], |
| 8 | + ['000 000 000', '000 000 000'], |
| 9 | + ['000-000-000', '000 000 000'], |
| 10 | + ['abc', 'abc'], |
| 11 | + ])('formatOrganizationNumber(%s) -> %s', (input, expected) => { |
| 12 | + expect(formatOrganizationNumberNo(input)).toBe(expected); |
10 | 13 | }); |
11 | | - |
12 | | - test.each([['000000000', '000 000 000']])( |
13 | | - 'formatOrganizationNumber(%s) -> %s', |
14 | | - (input, expected) => { |
15 | | - expect(formatOrganizationNumber(input, 'no')).toBe(expected); |
16 | | - }, |
17 | | - ); |
18 | 14 | }); |
19 | 15 |
|
20 | 16 | describe('se', () => { |
21 | | - test.each([['0701234567', '070-123 45 67']])( |
22 | | - 'formatPhoneNumber(%s) -> %s', |
23 | | - (input, expected) => { |
24 | | - expect(formatPhoneNumber(input, 'se')).toBe(expected); |
25 | | - }, |
26 | | - ); |
27 | | - |
28 | | - test.each([['0000000000', '000000-0000']])( |
29 | | - 'formatOrganizationNumber(%s) -> %s', |
30 | | - (input, expected) => { |
31 | | - expect(formatOrganizationNumber(input, 'se')).toBe(expected); |
32 | | - }, |
33 | | - ); |
| 17 | + test.each([ |
| 18 | + ['0000000000', '000000-0000'], |
| 19 | + ['000000-0000', '000000-0000'], |
| 20 | + ['000000 0000', '000000-0000'], |
| 21 | + [' 000000 0000 ', '000000-0000'], |
| 22 | + ['000', '000'], |
| 23 | + ['abc', 'abc'], |
| 24 | + ])('formatOrganizationNumber(%s) -> %s', (input, expected) => { |
| 25 | + expect(formatOrganizationNumberSe(input)).toBe(expected); |
| 26 | + }); |
34 | 27 | }); |
0 commit comments