Tests for drop, distance and differenceBy

This commit is contained in:
Angelos Chalaris
2018-02-03 11:58:24 +02:00
parent 11bbfb927c
commit 82b4583de2
4 changed files with 803 additions and 785 deletions

View File

@ -5,9 +5,11 @@ test('Testing differenceBy', (t) => {
//For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape
t.true(typeof differenceBy === 'function', 'differenceBy is a Function');
t.deepEqual(differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor), [1.2], 'Works using a native function and numbers');
t.deepEqual(differenceBy([{ x: 2 }, { x: 1 }], [{ x: 1 }], v => v.x), [ { x: 2 } ], 'Works with arrow function and objects');
//t.deepEqual(differenceBy(args..), 'Expected');
//t.equal(differenceBy(args..), 'Expected');
//t.false(differenceBy(args..), 'Expected');
//t.throws(differenceBy(args..), 'Expected');
t.end();
});
});

View File

@ -5,9 +5,10 @@ test('Testing distance', (t) => {
//For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape
t.true(typeof distance === 'function', 'distance is a Function');
t.equals(distance(1, 1, 2, 3), 2.23606797749979, 'Calculates the distance between two points');
//t.deepEqual(distance(args..), 'Expected');
//t.equal(distance(args..), 'Expected');
//t.false(distance(args..), 'Expected');
//t.throws(distance(args..), 'Expected');
t.end();
});
});

View File

@ -5,9 +5,12 @@ test('Testing drop', (t) => {
//For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape
t.true(typeof drop === 'function', 'drop is a Function');
t.deepEqual(drop([1, 2, 3]), [2,3], 'Works without the last argument');
t.deepEqual(drop([1, 2, 3], 2), [3], 'Removes appropriate element count as specified');
t.deepEqual(drop([1, 2, 3], 42), [], 'Empties array given a count greater than length');
//t.deepEqual(drop(args..), 'Expected');
//t.equal(drop(args..), 'Expected');
//t.false(drop(args..), 'Expected');
//t.throws(drop(args..), 'Expected');
t.end();
});
});

File diff suppressed because it is too large Load Diff