Sha256: 4a01cb65c873740d1236fd7cc2357681c83f79632684950c0485e32367e388cf

Contents?: true

Size: 860 Bytes

Versions: 185

Compression:

Stored size: 860 Bytes

Contents

import Luhn from './luhn';

describe('Luhn', () => {
  test('single digit strings can not be valid', () => {
    const luhn = new Luhn('1');
    expect(luhn.valid).toEqual(false);
  });

  xtest('A single zero is invalid', () => {
    const luhn = new Luhn('0');
    expect(luhn.valid).toEqual(false);
  });

  xtest('valid Canadian SIN', () => {
    const luhn = new Luhn('046 454 286');
    expect(luhn.valid).toEqual(true);
  });

  xtest('invalid Canadian SIN', () => {
    const luhn = new Luhn('046 454 287');
    expect(luhn.valid).toEqual(false);
  });

  xtest('invalid credit card', () => {
    const luhn = new Luhn('8273 1232 7352 0569');
    expect(luhn.valid).toEqual(false);
  });

  xtest('valid strings with a non-digit added become invalid', () => {
    const luhn = new Luhn('046a 454 286');
    expect(luhn.valid).toEqual(false);
  });
});

Version data entries

185 entries across 185 versions & 1 rubygems

Version Path
trackler-2.2.1.139 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.2.1.138 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.2.1.137 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.2.1.136 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.2.1.135 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.2.1.134 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.2.1.133 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.2.1.132 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.2.1.131 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.2.1.130 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.2.1.129 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.2.1.128 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.2.1.127 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.2.1.126 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.2.1.125 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.2.1.124 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.2.1.123 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.2.1.122 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.2.1.121 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.2.1.120 tracks/ecmascript/exercises/luhn/luhn.spec.js