Sha256: 149135de212309b5b61bf4d9eb600083d9cdd45b4789c643de102e5409847d87

Contents?: true

Size: 1.19 KB

Versions: 57

Compression:

Stored size: 1.19 KB

Contents

import transform from './etl'

describe('Transform', () => {

  it('transforms one value', () => {
    const old: {[key: string]: string[]} = { 1: [ 'A' ] }
    const expected: {[key: string]: number} = { a: 1 }

    expect(transform(old)).toEqual(expected)
  })

  it('transforms more values', () => {
    const old = { 1: [ 'A', 'E', 'I', 'O', 'U' ] }
    const expected = { a: 1, e: 1, i: 1, o: 1, u: 1 }

    expect(transform(old)).toEqual(expected)
  })

  it('transforms more keys', () => {
    const old = { 1: [ 'A', 'E' ], 2: [ 'D', 'G' ] }
    const expected = { a: 1, e: 1, d: 2, g: 2 }

    expect(transform(old)).toEqual(expected)
  })

  it('transforms a full dataset', () => {
    const old = {
      1: [ 'A', 'E', 'I', 'O', 'U', 'L', 'N', 'R', 'S', 'T' ],
      2: [ 'D', 'G' ],
      3: [ 'B', 'C', 'M', 'P' ],
      4: [ 'F', 'H', 'V', 'W', 'Y' ],
      5: [ 'K' ],
      8: [ 'J', 'X' ],
      10: [ 'Q', 'Z' ]
    }
    const expected = {
      a: 1, b: 3,  c: 3, d: 2, e: 1,
      f: 4, g: 2,  h: 4, i: 1, j: 8,
      k: 5, l: 1,  m: 3, n: 1, o: 1,
      p: 3, q: 10, r: 1, s: 1, t: 1,
      u: 1, v: 4,  w: 4, x: 8, y: 4,
      z: 10
    }

    expect(transform(old)).toEqual(expected)
  })

})

Version data entries

57 entries across 57 versions & 1 rubygems

Version Path
trackler-2.0.8.32 tracks/typescript/exercises/etl/etl.test.ts
trackler-2.0.8.31 tracks/typescript/exercises/etl/etl.test.ts
trackler-2.0.8.30 tracks/typescript/exercises/etl/etl.test.ts
trackler-2.0.8.29 tracks/typescript/exercises/etl/etl.test.ts
trackler-2.0.8.28 tracks/typescript/exercises/etl/etl.test.ts
trackler-2.0.8.27 tracks/typescript/exercises/etl/etl.test.ts
trackler-2.0.8.26 tracks/typescript/exercises/etl/etl.test.ts
trackler-2.0.8.24 tracks/typescript/exercises/etl/etl.test.ts
trackler-2.0.8.23 tracks/typescript/exercises/etl/etl.test.ts
trackler-2.0.8.22 tracks/typescript/exercises/etl/etl.test.ts
trackler-2.0.8.21 tracks/typescript/exercises/etl/etl.test.ts
trackler-2.0.8.20 tracks/typescript/exercises/etl/etl.test.ts
trackler-2.0.8.19 tracks/typescript/exercises/etl/etl.test.ts
trackler-2.0.8.18 tracks/typescript/exercises/etl/etl.test.ts
trackler-2.0.8.17 tracks/typescript/exercises/etl/etl.test.ts
trackler-2.0.8.16 tracks/typescript/exercises/etl/etl.test.ts
trackler-2.0.8.15 tracks/typescript/exercises/etl/etl.test.ts