Sha256: 4b76d515b8f7d822cbcd41ab7bb6fa7af5c1724fa4eaaf70d855120608ef3bcf

Contents?: true

Size: 1.09 KB

Versions: 207

Compression:

Stored size: 1.09 KB

Contents

Luhn = require './luhn'

describe 'Luhn', ->

  it "check digit", ->
    luhn = new Luhn(34567)
    expect(luhn.checkDigit).toEqual(7)

  xit "check digit again", ->
    luhn = new Luhn(91370)
    expect(luhn.checkDigit).toEqual(0)

  xit "addends", ->
    luhn = new Luhn(12121)
    expect(luhn.addends).toEqual([1, 4, 1, 4, 1])

  xit "too large added", ->
    luhn = new Luhn(8631)
    expect(luhn.addends).toEqual([7, 6, 6, 1])

  xit "checksum", ->
    luhn = new Luhn(4913)
    expect(luhn.checksum).toEqual(22)

  xit "checksum again", ->
    luhn = new Luhn(201773)
    expect(luhn.checksum).toEqual(21)

  xit "invalid number", ->
    luhn = new Luhn(738)
    expect(luhn.valid).toEqual(false)

  xit "valid number", ->
    luhn = new Luhn(8739567)
    expect(luhn.valid).toEqual(true)

  xit "create valid number", ->
    number = Luhn.create(123)
    expect(number).toEqual(1230)

  xit "create other valid number", ->
    number = Luhn.create(873956)
    expect(number).toEqual(8739567)

  xit "create yet another valid number", ->
    number = Luhn.create(837263756)
    expect(number).toEqual(8372637564)

Version data entries

207 entries across 207 versions & 1 rubygems

Version Path
trackler-2.2.1.38 tracks/coffeescript/exercises/luhn/luhn_test.spec.coffee
trackler-2.2.1.37 tracks/coffeescript/exercises/luhn/luhn_test.spec.coffee
trackler-2.2.1.36 tracks/coffeescript/exercises/luhn/luhn_test.spec.coffee
trackler-2.2.1.35 tracks/coffeescript/exercises/luhn/luhn_test.spec.coffee
trackler-2.2.1.34 tracks/coffeescript/exercises/luhn/luhn_test.spec.coffee
trackler-2.2.1.33 tracks/coffeescript/exercises/luhn/luhn_test.spec.coffee
trackler-2.2.1.32 tracks/coffeescript/exercises/luhn/luhn_test.spec.coffee
trackler-2.2.1.31 tracks/coffeescript/exercises/luhn/luhn_test.spec.coffee
trackler-2.2.1.30 tracks/coffeescript/exercises/luhn/luhn_test.spec.coffee
trackler-2.2.1.29 tracks/coffeescript/exercises/luhn/luhn_test.spec.coffee
trackler-2.2.1.28 tracks/coffeescript/exercises/luhn/luhn_test.spec.coffee
trackler-2.2.1.27 tracks/coffeescript/exercises/luhn/luhn_test.spec.coffee
trackler-2.2.1.26 tracks/coffeescript/exercises/luhn/luhn_test.spec.coffee
trackler-2.2.1.25 tracks/coffeescript/exercises/luhn/luhn_test.spec.coffee
trackler-2.2.1.24 tracks/coffeescript/exercises/luhn/luhn_test.spec.coffee
trackler-2.2.1.23 tracks/coffeescript/exercises/luhn/luhn_test.spec.coffee
trackler-2.2.1.22 tracks/coffeescript/exercises/luhn/luhn_test.spec.coffee
trackler-2.2.1.21 tracks/coffeescript/exercises/luhn/luhn_test.spec.coffee
trackler-2.2.1.20 tracks/coffeescript/exercises/luhn/luhn_test.spec.coffee
trackler-2.2.1.19 tracks/coffeescript/exercises/luhn/luhn_test.spec.coffee