bigbuffet-rw/app/soapbox/utils/__tests__/phone.test.ts
marcin mikołajczak 5fec879148 Fix mutes test, prefer TypeScript for tests
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2022-06-12 16:30:48 +02:00

29 lines
788 B
TypeScript

import { formatPhoneNumber } from '../phone';
describe('Phone unit tests', () => {
it('Properly formats', () => {
let number = '';
expect(formatPhoneNumber(number)).toEqual('');
number = '5';
expect(formatPhoneNumber(number)).toEqual('+1 (5');
number = '55';
expect(formatPhoneNumber(number)).toEqual('+1 (55');
number = '555';
expect(formatPhoneNumber(number)).toEqual('+1 (555');
number = '55513';
expect(formatPhoneNumber(number)).toEqual('+1 (555) 13');
number = '555135';
expect(formatPhoneNumber(number)).toEqual('+1 (555) 135');
number = '5551350';
expect(formatPhoneNumber(number)).toEqual('+1 (555) 135-0');
number = '5551350123';
expect(formatPhoneNumber(number)).toEqual('+1 (555) 135-0123');
});
});