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.1.0.48 tracks/javascript/exercises/phone-number/phone-number.spec.js
trackler-2.1.0.47 tracks/javascript/exercises/phone-number/phone-number.spec.js
trackler-2.1.0.46 tracks/javascript/exercises/phone-number/phone-number.spec.js
trackler-2.1.0.45 tracks/javascript/exercises/phone-number/phone-number.spec.js
trackler-2.1.0.44 tracks/javascript/exercises/phone-number/phone-number.spec.js
trackler-2.1.0.43 tracks/javascript/exercises/phone-number/phone-number.spec.js
trackler-2.1.0.42 tracks/javascript/exercises/phone-number/phone-number.spec.js
trackler-2.1.0.41 tracks/javascript/exercises/phone-number/phone-number.spec.js
trackler-2.1.0.40 tracks/javascript/exercises/phone-number/phone-number.spec.js
trackler-2.1.0.39 tracks/javascript/exercises/phone-number/phone-number.spec.js
trackler-2.1.0.38 tracks/javascript/exercises/phone-number/phone-number.spec.js
trackler-2.1.0.37 tracks/javascript/exercises/phone-number/phone-number.spec.js
trackler-2.1.0.36 tracks/javascript/exercises/phone-number/phone-number.spec.js
trackler-2.1.0.34 tracks/javascript/exercises/phone-number/phone-number.spec.js
trackler-2.1.0.33 tracks/javascript/exercises/phone-number/phone-number.spec.js
trackler-2.1.0.32 tracks/javascript/exercises/phone-number/phone-number.spec.js
trackler-2.1.0.31 tracks/javascript/exercises/phone-number/phone-number.spec.js
trackler-2.1.0.30 tracks/javascript/exercises/phone-number/phone-number.spec.js
trackler-2.1.0.29 tracks/javascript/exercises/phone-number/phone-number.spec.js
trackler-2.1.0.28 tracks/javascript/exercises/phone-number/phone-number.spec.js