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.119 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.118 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.117 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.116 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.115 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.114 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.113 tracks/javascript/exercises/flatten-array/flatten-array.spec.js
trackler-2.2.1.111 tracks/javascript/exercises/flatten-array/flatten-array.spec.js