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.159 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.2.1.158 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.2.1.157 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.2.1.156 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.2.1.155 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.2.1.154 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.2.1.153 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.2.1.152 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.2.1.151 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.2.1.150 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.2.1.149 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.2.1.148 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.2.1.147 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.2.1.146 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.2.1.145 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.2.1.144 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.2.1.143 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.2.1.142 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.2.1.141 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.2.1.140 tracks/ecmascript/exercises/luhn/luhn.spec.js