Tests for sortedLastIndex, sortedLastIndexBy, sortedIndexBy

This commit is contained in:
Angelos Chalaris
2018-02-03 12:26:01 +02:00
parent c7f3b12584
commit 5e16bcbcc8
4 changed files with 12 additions and 6 deletions

View File

@ -5,9 +5,10 @@ test('Testing sortedIndexBy', (t) => {
//For more information on all the methods supported by tape //For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape //Please go to https://github.com/substack/tape
t.true(typeof sortedIndexBy === 'function', 'sortedIndexBy is a Function'); t.true(typeof sortedIndexBy === 'function', 'sortedIndexBy is a Function');
t.equal(sortedIndexBy([{ x: 4 }, { x: 5 }], { x: 4 }, o => o.x), 0, 'Returns the lowest index to insert the element without messing up the list order');
//t.deepEqual(sortedIndexBy(args..), 'Expected'); //t.deepEqual(sortedIndexBy(args..), 'Expected');
//t.equal(sortedIndexBy(args..), 'Expected'); //t.equal(sortedIndexBy(args..), 'Expected');
//t.false(sortedIndexBy(args..), 'Expected'); //t.false(sortedIndexBy(args..), 'Expected');
//t.throws(sortedIndexBy(args..), 'Expected'); //t.throws(sortedIndexBy(args..), 'Expected');
t.end(); t.end();
}); });

View File

@ -5,9 +5,10 @@ test('Testing sortedLastIndex', (t) => {
//For more information on all the methods supported by tape //For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape //Please go to https://github.com/substack/tape
t.true(typeof sortedLastIndex === 'function', 'sortedLastIndex is a Function'); t.true(typeof sortedLastIndex === 'function', 'sortedLastIndex is a Function');
t.equal(sortedLastIndex([10, 20, 30, 30, 40], 30), 3, 'Returns the highest index to insert the element without messing up the list order');
//t.deepEqual(sortedLastIndex(args..), 'Expected'); //t.deepEqual(sortedLastIndex(args..), 'Expected');
//t.equal(sortedLastIndex(args..), 'Expected'); //t.equal(sortedLastIndex(args..), 'Expected');
//t.false(sortedLastIndex(args..), 'Expected'); //t.false(sortedLastIndex(args..), 'Expected');
//t.throws(sortedLastIndex(args..), 'Expected'); //t.throws(sortedLastIndex(args..), 'Expected');
t.end(); t.end();
}); });

View File

@ -5,9 +5,10 @@ test('Testing sortedLastIndexBy', (t) => {
//For more information on all the methods supported by tape //For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape //Please go to https://github.com/substack/tape
t.true(typeof sortedLastIndexBy === 'function', 'sortedLastIndexBy is a Function'); t.true(typeof sortedLastIndexBy === 'function', 'sortedLastIndexBy is a Function');
t.equal(sortedLastIndexBy([{ x: 4 }, { x: 5 }], { x: 4 }, o => o.x), 1, 'Returns the highest index to insert the element without messing up the list order');
//t.deepEqual(sortedLastIndexBy(args..), 'Expected'); //t.deepEqual(sortedLastIndexBy(args..), 'Expected');
//t.equal(sortedLastIndexBy(args..), 'Expected'); //t.equal(sortedLastIndexBy(args..), 'Expected');
//t.false(sortedLastIndexBy(args..), 'Expected'); //t.false(sortedLastIndexBy(args..), 'Expected');
//t.throws(sortedLastIndexBy(args..), 'Expected'); //t.throws(sortedLastIndexBy(args..), 'Expected');
t.end(); t.end();
}); });

View File

@ -1,4 +1,4 @@
Test log for: Sat Feb 03 2018 12:21:49 GMT+0200 (GTB Standard Time) Test log for: Sat Feb 03 2018 12:25:38 GMT+0200 (GTB Standard Time)
> 30-seconds-of-code@0.0.1 test G:\My Files\git Repositories\30-seconds-of-code > 30-seconds-of-code@0.0.1 test G:\My Files\git Repositories\30-seconds-of-code
> tape test/**/*.test.js | tap-spec > tape test/**/*.test.js | tap-spec
@ -1263,14 +1263,17 @@ Test log for: Sat Feb 03 2018 12:21:49 GMT+0200 (GTB Standard Time)
Testing sortedIndexBy Testing sortedIndexBy
√ sortedIndexBy is a Function √ sortedIndexBy is a Function
√ Returns the lowest index to insert the element without messing up the list order
Testing sortedLastIndex Testing sortedLastIndex
√ sortedLastIndex is a Function √ sortedLastIndex is a Function
√ Returns the highest index to insert the element without messing up the list order
Testing sortedLastIndexBy Testing sortedLastIndexBy
√ sortedLastIndexBy is a Function √ sortedLastIndexBy is a Function
√ Returns the highest index to insert the element without messing up the list order
Testing speechSynthesis Testing speechSynthesis
@ -1642,8 +1645,8 @@ Test log for: Sat Feb 03 2018 12:21:49 GMT+0200 (GTB Standard Time)
√ Works with multiple promises √ Works with multiple promises
total: 746 total: 749
passing: 746 passing: 749
duration: 2.4s duration: 2.4s