Tests for takeWhile, takeRightWhile, times

This commit is contained in:
Angelos Chalaris
2018-02-03 12:18:04 +02:00
parent e69b900c5f
commit 185fef6ec2
4 changed files with 14 additions and 6 deletions

View File

@ -5,9 +5,10 @@ test('Testing takeRightWhile', (t) => {
//For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape
t.true(typeof takeRightWhile === 'function', 'takeRightWhile is a Function');
t.deepEqual(takeRightWhile([1, 2, 3, 4], n => n < 3), [3, 4], 'Removes elements until the function returns true');
//t.deepEqual(takeRightWhile(args..), 'Expected');
//t.equal(takeRightWhile(args..), 'Expected');
//t.false(takeRightWhile(args..), 'Expected');
//t.throws(takeRightWhile(args..), 'Expected');
t.end();
});
});

View File

@ -5,9 +5,10 @@ test('Testing takeWhile', (t) => {
//For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape
t.true(typeof takeWhile === 'function', 'takeWhile is a Function');
t.deepEqual(takeWhile([1, 2, 3, 4], n => n >= 3), [1, 2], 'Removes elements until the function returns true');
//t.deepEqual(takeWhile(args..), 'Expected');
//t.equal(takeWhile(args..), 'Expected');
//t.false(takeWhile(args..), 'Expected');
//t.throws(takeWhile(args..), 'Expected');
t.end();
});
});

View File

@ -1,4 +1,4 @@
Test log for: Sat Feb 03 2018 12:08:59 GMT+0200 (GTB Standard Time)
Test log for: Sat Feb 03 2018 12:17:47 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
@ -1346,10 +1346,12 @@ Test log for: Sat Feb 03 2018 12:08:59 GMT+0200 (GTB Standard Time)
Testing takeRightWhile
√ takeRightWhile is a Function
√ Removes elements until the function returns true
Testing takeWhile
√ takeWhile is a Function
√ Removes elements until the function returns true
Testing throttle
@ -1358,6 +1360,7 @@ Test log for: Sat Feb 03 2018 12:08:59 GMT+0200 (GTB Standard Time)
Testing times
√ times is a Function
√ Runs a function the specified amount of times
Testing timeTaken
@ -1636,8 +1639,8 @@ Test log for: Sat Feb 03 2018 12:08:59 GMT+0200 (GTB Standard Time)
√ Works with multiple promises
total: 740
passing: 740
total: 743
passing: 743
duration: 2.4s

View File

@ -5,9 +5,12 @@ test('Testing times', (t) => {
//For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape
t.true(typeof times === 'function', 'times is a Function');
var output = '';
times(5, i => (output += i));
t.equals(output, '01234', 'Runs a function the specified amount of times');
//t.deepEqual(times(args..), 'Expected');
//t.equal(times(args..), 'Expected');
//t.false(times(args..), 'Expected');
//t.throws(times(args..), 'Expected');
t.end();
});
});