Sha256: 7c1d462bd94388c284a64b75deca2cc17f0288714c649cbc38bd08eef334b91d
Contents?: true
Size: 1.1 KB
Versions: 56
Compression:
Stored size: 1.1 KB
Contents
import PhoneNumber from './phone-number'; describe('PhoneNumber()', () => { it('cleans the number (123) 456-7890', () => { const phone = new PhoneNumber('(123) 456-7890'); expect(phone.number()).toEqual('1234567890'); }); xit('cleans numbers with dots', () => { const phone = new PhoneNumber('123.456.7890'); expect(phone.number()).toEqual('1234567890'); }); xit('valid when 11 digits and first digit is 1', () => { const phone = new PhoneNumber('11234567890'); expect(phone.number()).toEqual('1234567890'); }); xit('invalid when 11 digits', () => { const phone = new PhoneNumber('21234567890'); expect(phone.number()).toEqual('0000000000'); }); xit('invalid when 9 digits', () => { const phone = new PhoneNumber('123456789'); expect(phone.number()).toEqual('0000000000'); }); xit('has an area code', () => { const phone = new PhoneNumber('1234567890'); expect(phone.areaCode()).toEqual('123'); }); xit('formats a number', () => { const phone = new PhoneNumber('1234567890'); expect(phone.toString()).toEqual('(123) 456-7890'); }); });
Version data entries
56 entries across 56 versions & 1 rubygems