Sha256: 66f23307b5674f303cbb2548e892d73db2c79667476028ee8294335ec00679a9

Contents?: true

Size: 1.76 KB

Versions: 91

Compression:

Stored size: 1.76 KB

Contents

var PhoneNumber = require('./phone-number');

describe('PhoneNumber()', function() {
  it('cleans the number (123) 456-7890', function() {
    var phone = new PhoneNumber('(123) 456-7890');
    expect(phone.number()).toEqual('1234567890');
  });

  xit('cleans numbers with dots', function() {
    var phone = new PhoneNumber('123.456.7890');
    expect(phone.number()).toEqual('1234567890');
  });

  xit('cleans some other number with dots', function() {
    var phone = new PhoneNumber('555.456.7890');
    expect(phone.number()).toEqual('5554567890');
  });

  xit('valid when 11 digits and first digit is 1', function() {
    var phone = new PhoneNumber('11234567890');
    expect(phone.number()).toEqual('1234567890');
  });

  xit('invalid when 11 digits and the first digit is NOT 1', function() {
    var phone = new PhoneNumber('2  1234567890');
    expect(phone.number()).toEqual('0000000000');
  });

  xit('invalid when 12 digits', function() {
    var phone = new PhoneNumber('991234567890');
    expect(phone.number()).toEqual('0000000000');
  });

  xit('invalid when 9 digits', function() {
    var phone = new PhoneNumber('123456789');
    expect(phone.number()).toEqual('0000000000');
  });

  xit('has an area code', function() {
    var phone = new PhoneNumber('1234567890');
    expect(phone.areaCode()).toEqual('123');
  });

  xit('has some other area code', function() {
    var phone = new PhoneNumber('5554567890');
    expect(phone.areaCode()).toEqual('555');
  });

  xit('formats a number', function() {
    var phone = new PhoneNumber('1234567890');
    expect(phone.toString()).toEqual('(123) 456-7890');
  });

  xit('formats some other number', function() {
    var phone = new PhoneNumber('5554567890');
    expect(phone.toString()).toEqual('(555) 456-7890');
  });
});

Version data entries

91 entries across 91 versions & 1 rubygems

Version Path
trackler-2.0.8.43 tracks/javascript/exercises/phone-number/phone-number.spec.js
trackler-2.0.8.42 tracks/javascript/exercises/phone-number/phone-number.spec.js
trackler-2.0.8.41 tracks/javascript/exercises/phone-number/phone-number.spec.js
trackler-2.0.8.40 tracks/javascript/exercises/phone-number/phone-number.spec.js
trackler-2.0.8.39 tracks/javascript/exercises/phone-number/phone-number.spec.js
trackler-2.0.8.38 tracks/javascript/exercises/phone-number/phone-number.spec.js
trackler-2.0.8.37 tracks/javascript/exercises/phone-number/phone-number.spec.js
trackler-2.0.8.36 tracks/javascript/exercises/phone-number/phone-number.spec.js
trackler-2.0.8.35 tracks/javascript/exercises/phone-number/phone-number.spec.js
trackler-2.0.8.34 tracks/javascript/exercises/phone-number/phone-number.spec.js
trackler-2.0.8.33 tracks/javascript/exercises/phone-number/phone-number.spec.js
trackler-2.0.8.32 tracks/javascript/exercises/phone-number/phone-number.spec.js
trackler-2.0.8.31 tracks/javascript/exercises/phone-number/phone-number.spec.js
trackler-2.0.8.30 tracks/javascript/exercises/phone-number/phone-number.spec.js
trackler-2.0.8.29 tracks/javascript/exercises/phone-number/phone-number.spec.js
trackler-2.0.8.28 tracks/javascript/exercises/phone-number/phone-number.spec.js
trackler-2.0.8.27 tracks/javascript/exercises/phone-number/phone-number.spec.js
trackler-2.0.8.26 tracks/javascript/exercises/phone-number/phone-number.spec.js
trackler-2.0.8.24 tracks/javascript/exercises/phone-number/phone-number.spec.js
trackler-2.0.8.23 tracks/javascript/exercises/phone-number/phone-number.spec.js