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.159 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.158 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.157 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.156 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.155 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.154 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.153 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.152 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.151 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.150 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.149 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.148 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.147 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.146 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.145 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.144 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.143 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.142 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.141 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.140 tracks/javascript/exercises/flatten-array/flatten-array.spec.js