UNPKG

ds-algo-study

Version:

Just experimenting with publishing a package

24 lines (18 loc) 780 B
import { formatPhoneNumber } from './FormatPhoneNumber' describe('PhoneNumberFormatting', () => { it('expects to return the formatted phone number', () => { expect(formatPhoneNumber('1234567890')).toEqual('(123) 456-7890') }) it('expects to return the formatted phone number', () => { expect(formatPhoneNumber(1234567890)).toEqual('(123) 456-7890') }) it('expects to throw a type error', () => { expect(() => { formatPhoneNumber('1234567') }).toThrow('Invalid phone number.') }) it('expects to throw a type error', () => { expect(() => { formatPhoneNumber('123456text') }).toThrow('Invalid phone number.') }) it('expects to throw a type error', () => { expect(() => { formatPhoneNumber(12345) }).toThrow('Invalid phone number.') }) })