From 81234d9d7309db817096aa311e75f1af3eb78045 Mon Sep 17 00:00:00 2001 From: Angelos Chalaris Date: Sat, 3 Feb 2018 12:20:15 +0200 Subject: [PATCH] Tests for symmetricDifferenceBy, symmetricDifferenceWith --- test/symmetricDifferenceBy/symmetricDifferenceBy.test.js | 3 ++- .../symmetricDifferenceWith.test.js | 7 ++++++- test/testlog | 8 +++++--- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/test/symmetricDifferenceBy/symmetricDifferenceBy.test.js b/test/symmetricDifferenceBy/symmetricDifferenceBy.test.js index 306e3d5e8..4b1fd4e3a 100644 --- a/test/symmetricDifferenceBy/symmetricDifferenceBy.test.js +++ b/test/symmetricDifferenceBy/symmetricDifferenceBy.test.js @@ -5,9 +5,10 @@ test('Testing symmetricDifferenceBy', (t) => { //For more information on all the methods supported by tape //Please go to https://github.com/substack/tape t.true(typeof symmetricDifferenceBy === 'function', 'symmetricDifferenceBy is a Function'); + t.deepEqual(symmetricDifferenceBy([2.1, 1.2], [2.3, 3.4], Math.floor), [ 1.2, 3.4 ], 'Returns the symmetric difference between two arrays, after applying the provided function to each array element of both'); //t.deepEqual(symmetricDifferenceBy(args..), 'Expected'); //t.equal(symmetricDifferenceBy(args..), 'Expected'); //t.false(symmetricDifferenceBy(args..), 'Expected'); //t.throws(symmetricDifferenceBy(args..), 'Expected'); t.end(); -}); \ No newline at end of file +}); diff --git a/test/symmetricDifferenceWith/symmetricDifferenceWith.test.js b/test/symmetricDifferenceWith/symmetricDifferenceWith.test.js index c2afcddd8..12267272d 100644 --- a/test/symmetricDifferenceWith/symmetricDifferenceWith.test.js +++ b/test/symmetricDifferenceWith/symmetricDifferenceWith.test.js @@ -5,9 +5,14 @@ test('Testing symmetricDifferenceWith', (t) => { //For more information on all the methods supported by tape //Please go to https://github.com/substack/tape t.true(typeof symmetricDifferenceWith === 'function', 'symmetricDifferenceWith is a Function'); + t.deepEqual(symmetricDifferenceWith( + [1, 1.2, 1.5, 3, 0], + [1.9, 3, 0, 3.9], + (a, b) => Math.round(a) === Math.round(b) +), [1, 1.2, 3.9], 'Returns the symmetric difference between two arrays, using a provided function as a comparator'); //t.deepEqual(symmetricDifferenceWith(args..), 'Expected'); //t.equal(symmetricDifferenceWith(args..), 'Expected'); //t.false(symmetricDifferenceWith(args..), 'Expected'); //t.throws(symmetricDifferenceWith(args..), 'Expected'); t.end(); -}); \ No newline at end of file +}); diff --git a/test/testlog b/test/testlog index 04671bf37..b35b3cd12 100644 --- a/test/testlog +++ b/test/testlog @@ -1,4 +1,4 @@ -Test log for: Sat Feb 03 2018 12:17:47 GMT+0200 (GTB Standard Time) +Test log for: Sat Feb 03 2018 12:19:55 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 @@ -1320,10 +1320,12 @@ Test log for: Sat Feb 03 2018 12:17:47 GMT+0200 (GTB Standard Time) Testing symmetricDifferenceBy √ symmetricDifferenceBy is a Function + √ Returns the symmetric difference between two arrays, after applying the provided function to each array element of both Testing symmetricDifferenceWith √ symmetricDifferenceWith is a Function + √ Returns the symmetric difference between two arrays, using a provided function as a comparator Testing tail @@ -1639,8 +1641,8 @@ Test log for: Sat Feb 03 2018 12:17:47 GMT+0200 (GTB Standard Time) √ Works with multiple promises - total: 743 - passing: 743 + total: 745 + passing: 745 duration: 2.4s