Sha256: a8de20f935ed1ecc10f366f02c6f70cc137b69e504d525aa72161f094092f47f

Contents?: true

Size: 1.26 KB

Versions: 185

Compression:

Stored size: 1.26 KB

Contents

import transform from './etl';

describe('Transform', () => {
  test('transforms one value', () => {
    const old = { 1: ['A'] };
    const expected = { a: 1 };

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

  xtest('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);
  });

  xtest('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);
  });

  xtest('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

185 entries across 185 versions & 1 rubygems

Version Path
trackler-2.2.1.139 tracks/ecmascript/exercises/etl/etl.spec.js
trackler-2.2.1.138 tracks/ecmascript/exercises/etl/etl.spec.js
trackler-2.2.1.137 tracks/ecmascript/exercises/etl/etl.spec.js
trackler-2.2.1.136 tracks/ecmascript/exercises/etl/etl.spec.js
trackler-2.2.1.135 tracks/ecmascript/exercises/etl/etl.spec.js
trackler-2.2.1.134 tracks/ecmascript/exercises/etl/etl.spec.js
trackler-2.2.1.133 tracks/ecmascript/exercises/etl/etl.spec.js
trackler-2.2.1.132 tracks/ecmascript/exercises/etl/etl.spec.js
trackler-2.2.1.131 tracks/ecmascript/exercises/etl/etl.spec.js
trackler-2.2.1.130 tracks/ecmascript/exercises/etl/etl.spec.js
trackler-2.2.1.129 tracks/ecmascript/exercises/etl/etl.spec.js
trackler-2.2.1.128 tracks/ecmascript/exercises/etl/etl.spec.js
trackler-2.2.1.127 tracks/ecmascript/exercises/etl/etl.spec.js
trackler-2.2.1.126 tracks/ecmascript/exercises/etl/etl.spec.js
trackler-2.2.1.125 tracks/ecmascript/exercises/etl/etl.spec.js
trackler-2.2.1.124 tracks/ecmascript/exercises/etl/etl.spec.js
trackler-2.2.1.123 tracks/ecmascript/exercises/etl/etl.spec.js
trackler-2.2.1.122 tracks/ecmascript/exercises/etl/etl.spec.js
trackler-2.2.1.121 tracks/ecmascript/exercises/etl/etl.spec.js
trackler-2.2.1.120 tracks/ecmascript/exercises/etl/etl.spec.js