Tests for findKey, findLastKey, findLast, findLastIndex
This commit is contained in:
@ -5,9 +5,17 @@ test('Testing findKey', (t) => {
|
||||
//For more information on all the methods supported by tape
|
||||
//Please go to https://github.com/substack/tape
|
||||
t.true(typeof findKey === 'function', 'findKey is a Function');
|
||||
t.deepEqual(findKey(
|
||||
{
|
||||
barney: { age: 36, active: true },
|
||||
fred: { age: 40, active: false },
|
||||
pebbles: { age: 1, active: true }
|
||||
},
|
||||
o => o['active']
|
||||
), 'barney', 'Returns the appropriate key');
|
||||
//t.deepEqual(findKey(args..), 'Expected');
|
||||
//t.equal(findKey(args..), 'Expected');
|
||||
//t.false(findKey(args..), 'Expected');
|
||||
//t.throws(findKey(args..), 'Expected');
|
||||
t.end();
|
||||
});
|
||||
});
|
||||
|
||||
@ -5,9 +5,10 @@ test('Testing findLast', (t) => {
|
||||
//For more information on all the methods supported by tape
|
||||
//Please go to https://github.com/substack/tape
|
||||
t.true(typeof findLast === 'function', 'findLast is a Function');
|
||||
t.equal(findLast([1, 2, 3, 4], n => n % 2 === 1), 3, 'Finds last element for which the given function returns true');
|
||||
//t.deepEqual(findLast(args..), 'Expected');
|
||||
//t.equal(findLast(args..), 'Expected');
|
||||
//t.false(findLast(args..), 'Expected');
|
||||
//t.throws(findLast(args..), 'Expected');
|
||||
t.end();
|
||||
});
|
||||
});
|
||||
|
||||
@ -5,9 +5,10 @@ test('Testing findLastIndex', (t) => {
|
||||
//For more information on all the methods supported by tape
|
||||
//Please go to https://github.com/substack/tape
|
||||
t.true(typeof findLastIndex === 'function', 'findLastIndex is a Function');
|
||||
t.equal(findLastIndex([1, 2, 3, 4], n => n % 2 === 1), 2, 'Finds last index for which the given function returns true');
|
||||
//t.deepEqual(findLastIndex(args..), 'Expected');
|
||||
//t.equal(findLastIndex(args..), 'Expected');
|
||||
//t.false(findLastIndex(args..), 'Expected');
|
||||
//t.throws(findLastIndex(args..), 'Expected');
|
||||
t.end();
|
||||
});
|
||||
});
|
||||
|
||||
@ -5,9 +5,17 @@ test('Testing findLastKey', (t) => {
|
||||
//For more information on all the methods supported by tape
|
||||
//Please go to https://github.com/substack/tape
|
||||
t.true(typeof findLastKey === 'function', 'findLastKey is a Function');
|
||||
t.equal(findLastKey(
|
||||
{
|
||||
barney: { age: 36, active: true },
|
||||
fred: { age: 40, active: false },
|
||||
pebbles: { age: 1, active: true }
|
||||
},
|
||||
o => o['active']
|
||||
), 'pebbles', 'Returns the appropriate key');
|
||||
//t.deepEqual(findLastKey(args..), 'Expected');
|
||||
//t.equal(findLastKey(args..), 'Expected');
|
||||
//t.false(findLastKey(args..), 'Expected');
|
||||
//t.throws(findLastKey(args..), 'Expected');
|
||||
t.end();
|
||||
});
|
||||
});
|
||||
|
||||
10
test/testlog
10
test/testlog
@ -1,4 +1,4 @@
|
||||
Test log for: Sat Feb 03 2018 12:51:49 GMT+0200 (GTB Standard Time)
|
||||
Test log for: Sat Feb 03 2018 12:55:18 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
|
||||
@ -381,18 +381,22 @@ Test log for: Sat Feb 03 2018 12:51:49 GMT+0200 (GTB Standard Time)
|
||||
Testing findKey
|
||||
|
||||
√ findKey is a Function
|
||||
√ Returns the appropriate key
|
||||
|
||||
Testing findLast
|
||||
|
||||
√ findLast is a Function
|
||||
√ Finds last element for which the given function returns true
|
||||
|
||||
Testing findLastIndex
|
||||
|
||||
√ findLastIndex is a Function
|
||||
√ Finds last index for which the given function returns true
|
||||
|
||||
Testing findLastKey
|
||||
|
||||
√ findLastKey is a Function
|
||||
√ Returns the appropriate key
|
||||
|
||||
Testing flatten
|
||||
|
||||
@ -1653,8 +1657,8 @@ Test log for: Sat Feb 03 2018 12:51:49 GMT+0200 (GTB Standard Time)
|
||||
√ Works with multiple promises
|
||||
|
||||
|
||||
total: 757
|
||||
passing: 757
|
||||
total: 761
|
||||
passing: 761
|
||||
duration: 2.4s
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user