Sha256: aad9949aa8a21581d3206e5946e07c3ab91066f2c265844dd1c5e8c329a8d8b3

Contents?: true

Size: 1.21 KB

Versions: 68

Compression:

Stored size: 1.21 KB

Contents

var Flattener = require('./flatten-array.js');

describe('FlattenArray', function () {
  var flattener = new Flattener();
  it('flattens a nested list', function () {
    expect(flattener.flatten([[]])).toEqual([]);
  });
  xit('flattens a 2 level nested list', function () {
    expect(flattener.flatten([1, [2, 3, 4], 5])).toEqual([1, 2, 3, 4, 5]);
  });
  xit('flattens a  3 level nested list', function () {
    expect(flattener.flatten([1, [2, 3, 4], 5, [6, [7, 8]]])).toEqual([1, 2, 3, 4, 5, 6, 7, 8]);
  });
  xit('flattens a 5 level nested list', function () {
    expect(flattener.flatten([0, 2, [[2, 3], 8, 100, 4, [[[50]]]], -2])).toEqual([0, 2, 2, 3, 8, 100, 4, 50, -2]);
  });
  xit('flattens a 6 level nest list', function () {
    expect(flattener.flatten([1, [2, [[3]], [4, [[5]]], 6, 7], 8])).toEqual([1, 2, 3, 4, 5, 6, 7, 8]);
  });
  xit('flattens a 6 level nest list with null values', function () {
    expect(flattener.flatten([0, 2, [[2, 3], 8, [[100]], null, [[null]]], -2])).toEqual([0, 2, 2, 3, 8, 100, -2]);
  });
  xit('returns an empty list if all values in nested list are null', function () {
    expect(flattener.flatten([null, [[[null]]], null, null, [[null, null], null], null])).toEqual([]);
  });
});

Version data entries

68 entries across 68 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.179 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.178 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.177 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.176 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.175 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.174 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.173 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.172 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.171 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.170 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.169 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.167 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.166 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.165 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.164 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.163 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.162 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.161 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.160 tracks/javascript/exercises/flatten-array/flatten-array.spec.js