From a7c0a73ff99284ec71df6fc3153f2fe92dda75cd Mon Sep 17 00:00:00 2001 From: Angelos Chalaris Date: Sat, 3 Feb 2018 12:04:15 +0200 Subject: [PATCH] Tests for unfold, unary --- test/testlog | 8 +++++--- test/unary/unary.test.js | 3 ++- test/unfold/unfold.test.js | 4 +++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/test/testlog b/test/testlog index 21f3a9c92..8e3107369 100644 --- a/test/testlog +++ b/test/testlog @@ -1,4 +1,4 @@ -Test log for: Sat Feb 03 2018 12:00:56 GMT+0200 (GTB Standard Time) +Test log for: Sat Feb 03 2018 12:03: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 @@ -1459,6 +1459,7 @@ Test log for: Sat Feb 03 2018 12:00:56 GMT+0200 (GTB Standard Time) Testing unary √ unary is a Function + √ Discards arguments after the first one Testing unescapeHTML @@ -1468,6 +1469,7 @@ Test log for: Sat Feb 03 2018 12:00:56 GMT+0200 (GTB Standard Time) Testing unfold √ unfold is a Function + √ Works with a given function, producing an array Testing union @@ -1633,8 +1635,8 @@ Test log for: Sat Feb 03 2018 12:00:56 GMT+0200 (GTB Standard Time) √ Works with multiple promises - total: 737 - passing: 737 + total: 739 + passing: 739 duration: 2.4s diff --git a/test/unary/unary.test.js b/test/unary/unary.test.js index 9a6f878f9..4ea62e7a1 100644 --- a/test/unary/unary.test.js +++ b/test/unary/unary.test.js @@ -5,9 +5,10 @@ test('Testing unary', (t) => { //For more information on all the methods supported by tape //Please go to https://github.com/substack/tape t.true(typeof unary === 'function', 'unary is a Function'); + t.deepEqual(['6', '8', '10'].map(unary(parseInt)), [6, 8, 10], 'Discards arguments after the first one'); //t.deepEqual(unary(args..), 'Expected'); //t.equal(unary(args..), 'Expected'); //t.false(unary(args..), 'Expected'); //t.throws(unary(args..), 'Expected'); t.end(); -}); \ No newline at end of file +}); diff --git a/test/unfold/unfold.test.js b/test/unfold/unfold.test.js index ac4334008..bf14e7290 100644 --- a/test/unfold/unfold.test.js +++ b/test/unfold/unfold.test.js @@ -5,9 +5,11 @@ test('Testing unfold', (t) => { //For more information on all the methods supported by tape //Please go to https://github.com/substack/tape t.true(typeof unfold === 'function', 'unfold is a Function'); + var f = n => (n > 50 ? false : [-n, n + 10]); + t.deepEqual(unfold(f, 10), [-10, -20, -30, -40, -50], 'Works with a given function, producing an array'); //t.deepEqual(unfold(args..), 'Expected'); //t.equal(unfold(args..), 'Expected'); //t.false(unfold(args..), 'Expected'); //t.throws(unfold(args..), 'Expected'); t.end(); -}); \ No newline at end of file +});