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.139 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.138 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.137 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.136 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.135 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.134 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.133 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.132 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.131 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.130 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.129 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.128 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.127 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.126 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.125 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.124 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.123 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.122 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.121 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.120 tracks/javascript/exercises/flatten-array/flatten-array.spec.js