|
1 | | -import { formatPhoneNumber } from '../FormatPhoneNumber' |
2 | | - |
3 | | -describe('PhoneNumberFormatting', () => { |
4 | | - it('expects to return the formatted phone number', () => { |
5 | | - expect(formatPhoneNumber('1234567890')).toEqual('(123) 456-7890') |
6 | | - }) |
7 | | - |
8 | | - it('expects to return the formatted phone number', () => { |
9 | | - expect(formatPhoneNumber(1234567890)).toEqual('(123) 456-7890') |
10 | | - }) |
| 1 | +import formatPhoneNumber from '../FormatPhoneNumber' |
11 | 2 |
|
| 3 | +describe('Testing the formatPhoneNumber functions', () => { |
12 | 4 | it('expects to throw a type error', () => {
|
13 | | - expect(() => { formatPhoneNumber('1234567') }).toThrow('Invalid phone number.') |
| 5 | + expect(() => formatPhoneNumber('1234567')).toThrow('Invalid phone number!') |
| 6 | + expect(() => formatPhoneNumber('123456text')).toThrow('Invalid phone number!') |
| 7 | + expect(() => formatPhoneNumber(12345)).toThrow('Invalid phone number!') |
14 | 8 | })
|
15 | 9 |
|
16 | | - it('expects to throw a type error', () => { |
17 | | - expect(() => { formatPhoneNumber('123456text') }).toThrow('Invalid phone number.') |
18 | | - }) |
19 | | - |
20 | | - it('expects to throw a type error', () => { |
21 | | - expect(() => { formatPhoneNumber(12345) }).toThrow('Invalid phone number.') |
| 10 | + it('expects to return the formatted phone number', () => { |
| 11 | + expect(formatPhoneNumber('1234567890')).toEqual('(123) 456-7890') |
| 12 | + expect(formatPhoneNumber('2124323322')).toEqual('(212) 432-3322') |
| 13 | + expect(formatPhoneNumber('1721543455')).toEqual('(172) 154-3455') |
22 | 14 | })
|
23 | 15 | })
|
0 commit comments