Tests for forEachRight, forOwn, forOwnRight

This commit is contained in:
Angelos Chalaris
2018-02-03 12:59:41 +02:00
parent 4de1210378
commit b81d7a5759
4 changed files with 18 additions and 6 deletions

View File

@ -5,9 +5,12 @@ test('Testing forEachRight', (t) => {
//For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape
t.true(typeof forEachRight === 'function', 'forEachRight is a Function');
let output = '';
forEachRight([1, 2, 3, 4], val => output+=val);
t.equal(output, '4321', 'Iterates over the array in reverse');
//t.deepEqual(forEachRight(args..), 'Expected');
//t.equal(forEachRight(args..), 'Expected');
//t.false(forEachRight(args..), 'Expected');
//t.throws(forEachRight(args..), 'Expected');
t.end();
});
});

View File

@ -5,9 +5,12 @@ test('Testing forOwn', (t) => {
//For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape
t.true(typeof forOwn === 'function', 'forOwn is a Function');
let output = [];
forOwn({ foo: 'bar', a: 1 }, v => output.push(v)); // 'bar', 1
t.deepEqual(output, ['bar', 1], 'Iterates over an element\'s key-value pairs');
//t.deepEqual(forOwn(args..), 'Expected');
//t.equal(forOwn(args..), 'Expected');
//t.false(forOwn(args..), 'Expected');
//t.throws(forOwn(args..), 'Expected');
t.end();
});
});

View File

@ -5,9 +5,12 @@ test('Testing forOwnRight', (t) => {
//For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape
t.true(typeof forOwnRight === 'function', 'forOwnRight is a Function');
let output = [];
forOwnRight({ foo: 'bar', a: 1 }, v => output.push(v)); // 'bar', 1
t.deepEqual(output, [1, 'bar'], 'Iterates over an element\'s key-value pairs in reverse');
//t.deepEqual(forOwnRight(args..), 'Expected');
//t.equal(forOwnRight(args..), 'Expected');
//t.false(forOwnRight(args..), 'Expected');
//t.throws(forOwnRight(args..), 'Expected');
t.end();
});
});

View File

@ -1,4 +1,4 @@
Test log for: Sat Feb 03 2018 12:55:18 GMT+0200 (GTB Standard Time)
Test log for: Sat Feb 03 2018 12:59:22 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
@ -411,6 +411,7 @@ Test log for: Sat Feb 03 2018 12:55:18 GMT+0200 (GTB Standard Time)
Testing forEachRight
√ forEachRight is a Function
√ Iterates over the array in reverse
Testing formatDuration
@ -421,10 +422,12 @@ Test log for: Sat Feb 03 2018 12:55:18 GMT+0200 (GTB Standard Time)
Testing forOwn
√ forOwn is a Function
√ Iterates over an element's key-value pairs
Testing forOwnRight
√ forOwnRight is a Function
√ Iterates over an element's key-value pairs in reverse
Testing fromCamelCase
@ -1657,8 +1660,8 @@ Test log for: Sat Feb 03 2018 12:55:18 GMT+0200 (GTB Standard Time)
√ Works with multiple promises
total: 761
passing: 761
total: 764
passing: 764
duration: 2.4s