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.7 tracks/javascript/exercises/phone-number/phone-number.spec.js
trackler-2.1.0.6 tracks/javascript/exercises/phone-number/phone-number.spec.js
trackler-2.1.0.5 tracks/javascript/exercises/phone-number/phone-number.spec.js
trackler-2.1.0.4 tracks/javascript/exercises/phone-number/phone-number.spec.js
trackler-2.1.0.3 tracks/javascript/exercises/phone-number/phone-number.spec.js
trackler-2.1.0.2 tracks/javascript/exercises/phone-number/phone-number.spec.js
trackler-2.1.0.1 tracks/javascript/exercises/phone-number/phone-number.spec.js
trackler-2.1.0.0 tracks/javascript/exercises/phone-number/phone-number.spec.js
trackler-2.0.8.55 tracks/javascript/exercises/phone-number/phone-number.spec.js
trackler-2.0.8.54 tracks/javascript/exercises/phone-number/phone-number.spec.js
trackler-2.0.8.53 tracks/javascript/exercises/phone-number/phone-number.spec.js
trackler-2.0.8.52 tracks/javascript/exercises/phone-number/phone-number.spec.js
trackler-2.0.8.51 tracks/javascript/exercises/phone-number/phone-number.spec.js
trackler-2.0.8.50 tracks/javascript/exercises/phone-number/phone-number.spec.js
trackler-2.0.8.49 tracks/javascript/exercises/phone-number/phone-number.spec.js
trackler-2.0.8.48 tracks/javascript/exercises/phone-number/phone-number.spec.js
trackler-2.0.8.47 tracks/javascript/exercises/phone-number/phone-number.spec.js
trackler-2.0.8.46 tracks/javascript/exercises/phone-number/phone-number.spec.js
trackler-2.0.8.45 tracks/javascript/exercises/phone-number/phone-number.spec.js
trackler-2.0.8.44 tracks/javascript/exercises/phone-number/phone-number.spec.js