Tests for pull, pullBy, pullAtIndex, pullAtValue

This commit is contained in:
Angelos Chalaris
2018-02-04 21:02:32 +02:00
parent b19c621cad
commit 34f4a7e6fe
5 changed files with 28 additions and 8 deletions

View File

@ -5,9 +5,12 @@ test('Testing pull', (t) => {
//For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape
t.true(typeof pull === 'function', 'pull is a Function');
let myArray = ['a', 'b', 'c', 'a', 'b', 'c'];
pull(myArray, 'a', 'c');
t.deepEqual(myArray, ['b','b'], 'Pulls the specified values');
//t.deepEqual(pull(args..), 'Expected');
//t.equal(pull(args..), 'Expected');
//t.false(pull(args..), 'Expected');
//t.throws(pull(args..), 'Expected');
t.end();
});
});

View File

@ -5,9 +5,13 @@ test('Testing pullAtIndex', (t) => {
//For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape
t.true(typeof pullAtIndex === 'function', 'pullAtIndex is a Function');
let myArray = ['a', 'b', 'c', 'd'];
let pulled = pullAtIndex(myArray, [1, 3]);
t.deepEqual(myArray, [ 'a', 'c' ], 'Pulls the given values');
t.deepEqual(pulled, [ 'b', 'd' ], 'Pulls the given values');
//t.deepEqual(pullAtIndex(args..), 'Expected');
//t.equal(pullAtIndex(args..), 'Expected');
//t.false(pullAtIndex(args..), 'Expected');
//t.throws(pullAtIndex(args..), 'Expected');
t.end();
});
});

View File

@ -5,9 +5,13 @@ test('Testing pullAtValue', (t) => {
//For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape
t.true(typeof pullAtValue === 'function', 'pullAtValue is a Function');
let myArray = ['a', 'b', 'c', 'd'];
let pulled = pullAtValue(myArray, ['b', 'd']);
t.deepEqual(myArray, [ 'a', 'c' ], 'Pulls the specified values');
t.deepEqual(pulled, [ 'b', 'd' ], 'Pulls the specified values');
//t.deepEqual(pullAtValue(args..), 'Expected');
//t.equal(pullAtValue(args..), 'Expected');
//t.false(pullAtValue(args..), 'Expected');
//t.throws(pullAtValue(args..), 'Expected');
t.end();
});
});

View File

@ -5,9 +5,12 @@ test('Testing pullBy', (t) => {
//For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape
t.true(typeof pullBy === 'function', 'pullBy is a Function');
var myArray = [{ x: 1 }, { x: 2 }, { x: 3 }, { x: 1 }];
pullBy(myArray, [{ x: 1 }, { x: 3 }], o => o.x);
t.deepEqual(myArray, [{ x: 2 }], 'Pulls the specified values');
//t.deepEqual(pullBy(args..), 'Expected');
//t.equal(pullBy(args..), 'Expected');
//t.false(pullBy(args..), 'Expected');
//t.throws(pullBy(args..), 'Expected');
t.end();
});
});

View File

@ -1,4 +1,4 @@
Test log for: Sun Feb 04 2018 20:56:18 GMT+0200 (GTB Standard Time)
Test log for: Sun Feb 04 2018 21:02:13 GMT+0200 (GTB Standard Time)
> 30-seconds-of-code@0.0.1 test G:\My Files\git Repositories\30-seconds-of-code
> tape test/**/*.test.js | tap-spec
@ -1144,18 +1144,24 @@ Test log for: Sun Feb 04 2018 20:56:18 GMT+0200 (GTB Standard Time)
Testing pull
√ pull is a Function
√ Pulls the specified values
Testing pullAtIndex
√ pullAtIndex is a Function
√ Pulls the given values
√ Pulls the given values
Testing pullAtValue
√ pullAtValue is a Function
√ Pulls the specified values
√ Pulls the specified values
Testing pullBy
√ pullBy is a Function
√ Pulls the specified values
Testing quickSort
@ -1718,8 +1724,8 @@ Test log for: Sun Feb 04 2018 20:56:18 GMT+0200 (GTB Standard Time)
√ Works with multiple promises
total: 825
passing: 825
duration: 2.4s
total: 831
passing: 831
duration: 2.5s