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.180 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.2.1.179 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.2.1.178 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.2.1.177 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.2.1.176 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.2.1.175 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.2.1.174 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.2.1.173 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.2.1.172 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.2.1.171 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.2.1.170 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.2.1.169 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.2.1.167 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.2.1.166 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.2.1.165 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.2.1.164 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.2.1.163 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.2.1.162 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.2.1.161 tracks/ecmascript/exercises/luhn/luhn.spec.js
trackler-2.2.1.160 tracks/ecmascript/exercises/luhn/luhn.spec.js