Tests for reduceWhich, reduceSuccessive, removeNonASCII

This commit is contained in:
Angelos Chalaris
2018-02-03 12:52:14 +02:00
parent 73fe3b95da
commit cce302685e
4 changed files with 19 additions and 6 deletions

View File

@ -5,6 +5,7 @@ test('Testing reduceSuccessive', (t) => {
//For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape
t.true(typeof reduceSuccessive === 'function', 'reduceSuccessive is a Function');
t.deepEqual(reduceSuccessive([1, 2, 3, 4, 5, 6], (acc, val) => acc + val, 0), [0, 1, 3, 6, 10, 15, 21], 'Returns the array of successively reduced values');
//t.deepEqual(reduceSuccessive(args..), 'Expected');
//t.equal(reduceSuccessive(args..), 'Expected');
//t.false(reduceSuccessive(args..), 'Expected');

View File

@ -5,6 +5,12 @@ test('Testing reduceWhich', (t) => {
//For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape
t.true(typeof reduceWhich === 'function', 'reduceWhich is a Function');
t.equal(reduceWhich([1, 3, 2]), 1, 'Returns the minimum of an array');
t.equal(reduceWhich([1, 3, 2], (a, b) => b - a), 3, 'Returns the maximum of an array');
t.deepEqual(reduceWhich(
[{ name: 'Tom', age: 12 }, { name: 'Jack', age: 18 }, { name: 'Lucy', age: 9 }],
(a, b) => a.age - b.age
), {name: "Lucy", age: 9}, 'Returns the object with the minimum specified value in an array');
//t.deepEqual(reduceWhich(args..), 'Expected');
//t.equal(reduceWhich(args..), 'Expected');
//t.false(reduceWhich(args..), 'Expected');

View File

@ -5,6 +5,7 @@ test('Testing removeNonASCII', (t) => {
//For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape
t.true(typeof removeNonASCII === 'function', 'removeNonASCII is a Function');
t.equal(removeNonASCII('äÄçÇéÉêlorem-ipsumöÖÐþúÚ'), 'lorem-ipsum', 'Removes non-ASCII characters');
//t.deepEqual(removeNonASCII(args..), 'Expected');
//t.equal(removeNonASCII(args..), 'Expected');
//t.false(removeNonASCII(args..), 'Expected');

View File

@ -1,4 +1,4 @@
Test log for: Sat Feb 03 2018 12:32:27 GMT+0200 (GTB Standard Time)
Test log for: Sat Feb 03 2018 12:51:49 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
@ -1142,10 +1142,14 @@ Test log for: Sat Feb 03 2018 12:32:27 GMT+0200 (GTB Standard Time)
Testing reduceSuccessive
√ reduceSuccessive is a Function
√ Returns the array of successively reduced values
Testing reduceWhich
√ reduceWhich is a Function
√ Returns the minimum of an array
√ Returns the maximum of an array
√ Returns the object with the minimum specified value in an array
Testing remove
@ -1155,6 +1159,7 @@ Test log for: Sat Feb 03 2018 12:32:27 GMT+0200 (GTB Standard Time)
Testing removeNonASCII
√ removeNonASCII is a Function
√ Removes non-ASCII characters
Testing removeVowels
@ -1648,8 +1653,8 @@ Test log for: Sat Feb 03 2018 12:32:27 GMT+0200 (GTB Standard Time)
√ Works with multiple promises
total: 752
passing: 752
total: 757
passing: 757
duration: 2.4s