mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-06 17:50:39 +08:00
Added test for ScrambleStrings and formatted folder structure for other folders
This commit is contained in:
23
String/test/FormatPhoneNumber.test.js
Normal file
23
String/test/FormatPhoneNumber.test.js
Normal file
@ -0,0 +1,23 @@
|
||||
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.')
|
||||
})
|
||||
})
|
Reference in New Issue
Block a user