Sha256: 3398650a135aaf077823d4dbaaab968b0a157dd8b2a296dcd5d17c8f15caa92f

Contents?: true

Size: 1.71 KB

Versions: 59

Compression:

Stored size: 1.71 KB

Contents

import ISBN from './isbn-verifier'

describe('ISBN Verifier', () => {
    it('valid isbn number', () => {
        expect(new ISBN('3-598-21508-8').isValid()).toBeTruthy()
    })

    xit('invalid isbn check digit', () => {
        expect(new ISBN('3-598-21508-9').isValid()).toBeFalsy()
    })

    xit('valid isbn number with a check digit of 10', () => {
        expect(new ISBN('3-598-21507-X').isValid()).toBeTruthy()
    })

    xit('check digit is a character other than X', () => {
        expect(new ISBN('3-598-21507-A').isValid()).toBeFalsy()
    })

    xit('invalid character in isbn', () => {
        expect(new ISBN('3-598-2K507-0').isValid()).toBeFalsy()
    })

    xit('X is only valid as a check digit', () => {
        expect(new ISBN('3-598-2X507-9').isValid()).toBeFalsy()
    })

    xit('valid isbn without separating dashes', () => {
        expect(new ISBN('3598215088').isValid()).toBeTruthy()
    })

    xit('isbn without separating dashes and X as check digit', () => {
        expect(new ISBN('359821507X').isValid()).toBeTruthy()
    })

    xit('isbn without check digit and dashes', () => {
        expect(new ISBN('359821507').isValid()).toBeFalsy()
    })

    xit('too long isbn and no dashes', () => {
        expect(new ISBN('3598215078X').isValid()).toBeFalsy()
    })

    xit('isbn without check digit', () => {
        expect(new ISBN('3-598-21507').isValid()).toBeFalsy()
    })

    xit('too long isbn', () => {
        expect(new ISBN('3-598-21507-XX').isValid()).toBeFalsy()
    })

    xit('check digit of X should not be used for 0', () => {
        expect(new ISBN('3-598-21515-X').isValid()).toBeFalsy()
    })

    xit('empty isbn', () => {
        expect(new ISBN('').isValid()).toBeFalsy()
    })
})

Version data entries

59 entries across 59 versions & 1 rubygems

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