Sha256: 4f89de24d6620cc1cf7f9b921f374ee19973c32fca420102f1d21002557b3126

Contents?: true

Size: 1.31 KB

Versions: 63

Compression:

Stored size: 1.31 KB

Contents

import Luhn from './luhn'

describe('Luhn', () => {
    it('single digit strings can not be valid', () => {
        expect(Luhn.valid('1')).toBeFalsy()
    })

    xit('a single zero is invalid', () => {
        expect(Luhn.valid('0')).toBeFalsy()
    })

    xit('a simple valid SIN that remains valid if reversed', () => {
        expect(Luhn.valid('059')).toBeTruthy()
    })

    xit('a valid Canadian SIN', () => {
        expect(Luhn.valid('055 444 285')).toBeTruthy()
    })

    xit('invalid Canadian SIN', () => {
        expect(Luhn.valid('055 444 286')).toBeFalsy()
    })

    xit('invalid credit card', () => {
        expect(Luhn.valid('8273 1232 7352 0569')).toBeFalsy()
    })

    xit('valid strings with a non-digit included become invalid', () => {
        expect(Luhn.valid('055a 444 285')).toBeFalsy()
    })

    xit('valid strings with punctuation included become invalid', () => {
        expect(Luhn.valid('055-444-285')).toBeFalsy()
    })

    xit('valid strings with symbols included become invalid', () => {
        expect(Luhn.valid('055£ 444$ 285')).toBeFalsy()
    })

    xit('single zero with space is invalid', () => {
        expect(Luhn.valid(' 0')).toBeFalsy()
    })

    xit('input digit 9 is correctly converted to output digit 9', () => {
        expect(Luhn.valid('091')).toBeTruthy()
    })
})

Version data entries

63 entries across 63 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/typescript/exercises/luhn/luhn.test.ts
trackler-2.2.1.179 tracks/typescript/exercises/luhn/luhn.test.ts
trackler-2.2.1.178 tracks/typescript/exercises/luhn/luhn.test.ts
trackler-2.2.1.177 tracks/typescript/exercises/luhn/luhn.test.ts
trackler-2.2.1.176 tracks/typescript/exercises/luhn/luhn.test.ts
trackler-2.2.1.175 tracks/typescript/exercises/luhn/luhn.test.ts
trackler-2.2.1.174 tracks/typescript/exercises/luhn/luhn.test.ts
trackler-2.2.1.173 tracks/typescript/exercises/luhn/luhn.test.ts
trackler-2.2.1.172 tracks/typescript/exercises/luhn/luhn.test.ts
trackler-2.2.1.171 tracks/typescript/exercises/luhn/luhn.test.ts
trackler-2.2.1.170 tracks/typescript/exercises/luhn/luhn.test.ts
trackler-2.2.1.169 tracks/typescript/exercises/luhn/luhn.test.ts
trackler-2.2.1.167 tracks/typescript/exercises/luhn/luhn.test.ts
trackler-2.2.1.166 tracks/typescript/exercises/luhn/luhn.test.ts
trackler-2.2.1.165 tracks/typescript/exercises/luhn/luhn.test.ts
trackler-2.2.1.164 tracks/typescript/exercises/luhn/luhn.test.ts
trackler-2.2.1.163 tracks/typescript/exercises/luhn/luhn.test.ts
trackler-2.2.1.162 tracks/typescript/exercises/luhn/luhn.test.ts
trackler-2.2.1.161 tracks/typescript/exercises/luhn/luhn.test.ts
trackler-2.2.1.160 tracks/typescript/exercises/luhn/luhn.test.ts