import test from 'tape';
import '../src/flatten';

test('flatten with unspecified depth must flatten first level nesting (n = 1)', ({deepEqual, end}) => {
  const xs = [[1, 2, 3], [4, 5, 6]];
  const expected = [1, 2, 3, 4, 5, 6];

  const actual = xs.flatten(1);

  deepEqual(actual, expected);
  end();
});

test('flatten with unspecified depth must flatten second level nesting (n = 2)', ({deepEqual, end}) => {
  const xs = [[1, 2, 3], [4, 5, [6]]];
  const expected = [1, 2, 3, 4, 5, 6];

  const actual = xs.flatten(1);

  deepEqual(actual, expected);
  end();
});

test('flatten must be able to handle nested arrays with element arrays of varying depth', ({deepEqual, end}) => {
  const xs = [1, [[[[[[[[[[[[[[[[[[[[[2]]]]]]]]]]]]]]]]]]]]], [[1, 2], [3, 4]], [1], [1, 3, 4, 3], [1, [1, [2, [2, [[[[8]]]]]]]]];
  const expected = [1, 2, 1, 2, 3, 4, 1, 1, 3, 4, 3, 1, 1, 2, 2, 8];

  const actual = xs.flatten();

  deepEqual(actual, expected);
  end();
});
@@ -63,34 +63,26 @@
 en with 
-unspecified 
 depth 
+= 1 
 must fla
@@ -318,26 +318,18 @@
 ith 
-unspecified 
 depth 
+= 2 
 must
@@ -463,32 +463,282 @@
 , 3, 4, 5, 6%5D;%0A%0A
+  const actual = xs.flatten(2);%0A%0A  deepEqual(actual, expected);%0A  end();%0A%7D);%0A%0Atest('flatten with depth = 1 must flatten only one level (n = 1)', (%7BdeepEqual, end%7D) =%3E %7B%0A  const xs = %5B%5B1, 2, 3%5D, %5B4, 5, %5B6%5D%5D%5D;%0A  const expected = %5B1, 2, 3, 4, 5, %5B6%5D%5D;%0A%0A
   const actual =

fix certain test expectations and add a test that fails (must investigate expected behavior 0 vs 1 vs Infinity)