Sha256: 89ebeb2b03548a5aecdf645327918743be57d7828dc16bf39067e68edf7196af

Contents?: true

Size: 1.3 KB

Versions: 72

Compression:

Stored size: 1.3 KB

Contents

import Luhn from './luhn';

describe('Luhn',() => {

  it('check digit',() => {
    const luhn = new Luhn(34567);
    expect(luhn.checkDigit).toEqual(7);
  });

  xit('check digit again',() => {
    const luhn = new Luhn(91370);
    expect(luhn.checkDigit).toEqual(0);
  });

  xit('addends',() => {
    const luhn = new Luhn(12121);
    expect(luhn.addends).toEqual([1, 4, 1, 4, 1]);
  });

  xit('too large added',() => {
    const luhn = new Luhn(8631);
    expect(luhn.addends).toEqual([7, 6, 6, 1]);
  });

  xit('checksum',() => {
    const luhn = new Luhn(4913);
    expect(luhn.checksum).toEqual(22);
  });

  xit('checksum again',() => {
    const luhn = new Luhn(201773);
    expect(luhn.checksum).toEqual(21);
  });

  xit('invalid number',() => {
    const luhn = new Luhn(738);
    expect(luhn.valid).toEqual(false);
  });

  xit('invalid number',() => {
    const luhn = new Luhn(8739567);
    expect(luhn.valid).toEqual(true);
  });

  xit('create valid number',() => {
    const number = Luhn.create(123);
    expect(number).toEqual(1230);
  });

  xit('create other valid number',() => {
    const number = Luhn.create(873956);
    expect(number).toEqual(8739567);
  });

  xit('create yet another valid number',() => {
    const number = Luhn.create(837263756);
    expect(number).toEqual(8372637564);
  });

});

Version data entries

72 entries across 72 versions & 1 rubygems

Version Path
trackler-2.0.6.16 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.0.6.15 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.0.6.14 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.0.6.13 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.0.6.12 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.0.6.11 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.0.6.10 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.0.6.9 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.0.6.8 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.0.6.7 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.0.6.6 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.0.6.5 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.0.6.4 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.0.6.3 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.0.6.2 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.0.6.1 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.0.6.0 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.0.5.18 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.0.5.17 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.0.5.16 tracks/ecmascript/exercises/luhn/luhn.spec.js