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.1.0.16 tracks/typescript/exercises/etl/etl.test.ts
trackler-2.1.0.15 tracks/typescript/exercises/etl/etl.test.ts
trackler-2.1.0.14 tracks/typescript/exercises/etl/etl.test.ts
trackler-2.1.0.13 tracks/typescript/exercises/etl/etl.test.ts
trackler-2.1.0.12 tracks/typescript/exercises/etl/etl.test.ts
trackler-2.1.0.11 tracks/typescript/exercises/etl/etl.test.ts
trackler-2.1.0.10 tracks/typescript/exercises/etl/etl.test.ts
trackler-2.1.0.9 tracks/typescript/exercises/etl/etl.test.ts
trackler-2.1.0.8 tracks/typescript/exercises/etl/etl.test.ts
trackler-2.1.0.7 tracks/typescript/exercises/etl/etl.test.ts
trackler-2.1.0.6 tracks/typescript/exercises/etl/etl.test.ts
trackler-2.1.0.5 tracks/typescript/exercises/etl/etl.test.ts
trackler-2.1.0.4 tracks/typescript/exercises/etl/etl.test.ts
trackler-2.1.0.3 tracks/typescript/exercises/etl/etl.test.ts
trackler-2.1.0.2 tracks/typescript/exercises/etl/etl.test.ts
trackler-2.1.0.1 tracks/typescript/exercises/etl/etl.test.ts
trackler-2.1.0.0 tracks/typescript/exercises/etl/etl.test.ts
trackler-2.0.8.55 tracks/typescript/exercises/etl/etl.test.ts
trackler-2.0.8.54 tracks/typescript/exercises/etl/etl.test.ts
trackler-2.0.8.53 tracks/typescript/exercises/etl/etl.test.ts