Sha256: 4a41800563aee040aba1ffee9bc78427cd0a1c14f7eb4e64ef2140745cd8376e

Contents?: true

Size: 1.49 KB

Versions: 135

Compression:

Stored size: 1.49 KB

Contents

import Series from './series'

describe('Series', () => {
  it('has digits (short)', () => {
    expect(new Series('01234').digits).toEqual([0, 1, 2, 3, 4])
  })

  xit('has digits (long)', () => {
    expect(new Series('0123456789').digits)
      .toEqual([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
  })

  xit('keeps the digit order if reversed', () => {
    expect(new Series('9876543210').digits)
      .toEqual([9, 8, 7, 6, 5, 4, 3, 2, 1, 0])
  })

  xit('keeps arbitrary digit order', () => {
    expect(new Series('936923468').digits)
      .toEqual([9, 3, 6, 9, 2, 3, 4, 6, 8])
  })

  xit('can slice by 1', () => {
    expect(new Series('01234').slices(1))
      .toEqual([[0], [1], [2], [3], [4]])
  })

  xit('can slice by 2', () => {
    expect(new Series('98273463').slices(2))
      .toEqual([[9, 8], [8, 2], [2, 7], [7, 3], [3, 4], [4, 6], [6, 3]])
  })

  xit('can slice by 3', () => {
    expect(new Series('01234').slices(3))
      .toEqual([[0, 1, 2], [1, 2, 3], [2, 3, 4]])
  })

  xit('can slice by 3 with duplicate digits', () => {
    expect(new Series('31001').slices(3))
      .toEqual([[3, 1, 0], [1, 0, 0], [0, 0, 1]])
  })

  xit('can slice by 4', () => {
    expect(new Series('91274').slices(4))
      .toEqual([[9, 1, 2, 7], [1, 2, 7, 4]])
  })

  xit('can slice by 5', () => {
    expect(new Series('81228').slices(5))
      .toEqual([[8, 1, 2, 2, 8]])
  })

  xit('throws an error if not enough digits to slice', () => {
    expect(() => {
      new Series('01032987583').slices(12)
    }).toThrow()
  })
})

Version data entries

135 entries across 135 versions & 1 rubygems

Version Path
trackler-2.2.1.119 tracks/typescript/exercises/series/series.test.ts
trackler-2.2.1.118 tracks/typescript/exercises/series/series.test.ts
trackler-2.2.1.117 tracks/typescript/exercises/series/series.test.ts
trackler-2.2.1.116 tracks/typescript/exercises/series/series.test.ts
trackler-2.2.1.115 tracks/typescript/exercises/series/series.test.ts
trackler-2.2.1.114 tracks/typescript/exercises/series/series.test.ts
trackler-2.2.1.113 tracks/typescript/exercises/series/series.test.ts
trackler-2.2.1.111 tracks/typescript/exercises/series/series.test.ts
trackler-2.2.1.110 tracks/typescript/exercises/series/series.test.ts
trackler-2.2.1.109 tracks/typescript/exercises/series/series.test.ts
trackler-2.2.1.108 tracks/typescript/exercises/series/series.test.ts
trackler-2.2.1.107 tracks/typescript/exercises/series/series.test.ts
trackler-2.2.1.106 tracks/typescript/exercises/series/series.test.ts
trackler-2.2.1.105 tracks/typescript/exercises/series/series.test.ts
trackler-2.2.1.104 tracks/typescript/exercises/series/series.test.ts
trackler-2.2.1.103 tracks/typescript/exercises/series/series.test.ts
trackler-2.2.1.102 tracks/typescript/exercises/series/series.test.ts
trackler-2.2.1.101 tracks/typescript/exercises/series/series.test.ts
trackler-2.2.1.100 tracks/typescript/exercises/series/series.test.ts
trackler-2.2.1.99 tracks/typescript/exercises/series/series.test.ts