From bdac20fb7f81daf7320afbf4ddd14aa507cbacc7 Mon Sep 17 00:00:00 2001 From: Angelos Chalaris Date: Sat, 3 Feb 2018 12:59:41 +0200 Subject: [PATCH] Tests for forEachRight, forOwn, forOwnRight --- test/forEachRight/forEachRight.test.js | 5 ++++- test/forOwn/forOwn.test.js | 5 ++++- test/forOwnRight/forOwnRight.test.js | 5 ++++- test/testlog | 9 ++++++--- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/test/forEachRight/forEachRight.test.js b/test/forEachRight/forEachRight.test.js index 75cfdec4b..2b6b8a956 100644 --- a/test/forEachRight/forEachRight.test.js +++ b/test/forEachRight/forEachRight.test.js @@ -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(); -}); \ No newline at end of file +}); diff --git a/test/forOwn/forOwn.test.js b/test/forOwn/forOwn.test.js index 5962d9ee4..b6910eb1f 100644 --- a/test/forOwn/forOwn.test.js +++ b/test/forOwn/forOwn.test.js @@ -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(); -}); \ No newline at end of file +}); diff --git a/test/forOwnRight/forOwnRight.test.js b/test/forOwnRight/forOwnRight.test.js index ecd69a71c..66c783785 100644 --- a/test/forOwnRight/forOwnRight.test.js +++ b/test/forOwnRight/forOwnRight.test.js @@ -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(); -}); \ No newline at end of file +}); diff --git a/test/testlog b/test/testlog index 2ffb59722..0f98c4435 100644 --- a/test/testlog +++ b/test/testlog @@ -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