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,6 +5,7 @@ test('Testing takeRightWhile', (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 takeRightWhile === 'function', 'takeRightWhile is a Function'); 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.deepEqual(takeRightWhile(args..), 'Expected');
//t.equal(takeRightWhile(args..), 'Expected'); //t.equal(takeRightWhile(args..), 'Expected');
//t.false(takeRightWhile(args..), 'Expected'); //t.false(takeRightWhile(args..), 'Expected');

View File

@@ -5,6 +5,7 @@ test('Testing takeWhile', (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 takeWhile === 'function', 'takeWhile is a Function'); 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.deepEqual(takeWhile(args..), 'Expected');
//t.equal(takeWhile(args..), 'Expected'); //t.equal(takeWhile(args..), 'Expected');
//t.false(takeWhile(args..), 'Expected'); //t.false(takeWhile(args..), 'Expected');

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

View File

@@ -5,6 +5,9 @@ test('Testing times', (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 times === 'function', 'times is a Function'); 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.deepEqual(times(args..), 'Expected');
//t.equal(times(args..), 'Expected'); //t.equal(times(args..), 'Expected');
//t.false(times(args..), 'Expected'); //t.false(times(args..), 'Expected');