From bb6ae04e78ba6111a135cc7773507e39b57166b9 Mon Sep 17 00:00:00 2001 From: Angelos Chalaris Date: Sun, 4 Feb 2018 21:02:32 +0200 Subject: [PATCH] Tests for pull, pullBy, pullAtIndex, pullAtValue --- test/pull/pull.test.js | 5 ++++- test/pullAtIndex/pullAtIndex.test.js | 6 +++++- test/pullAtValue/pullAtValue.test.js | 6 +++++- test/pullBy/pullBy.test.js | 5 ++++- test/testlog | 14 ++++++++++---- 5 files changed, 28 insertions(+), 8 deletions(-) diff --git a/test/pull/pull.test.js b/test/pull/pull.test.js index aa4b11755..81299a3f8 100644 --- a/test/pull/pull.test.js +++ b/test/pull/pull.test.js @@ -5,9 +5,12 @@ test('Testing pull', (t) => { //For more information on all the methods supported by tape //Please go to https://github.com/substack/tape t.true(typeof pull === 'function', 'pull is a Function'); + let myArray = ['a', 'b', 'c', 'a', 'b', 'c']; + pull(myArray, 'a', 'c'); + t.deepEqual(myArray, ['b','b'], 'Pulls the specified values'); //t.deepEqual(pull(args..), 'Expected'); //t.equal(pull(args..), 'Expected'); //t.false(pull(args..), 'Expected'); //t.throws(pull(args..), 'Expected'); t.end(); -}); \ No newline at end of file +}); diff --git a/test/pullAtIndex/pullAtIndex.test.js b/test/pullAtIndex/pullAtIndex.test.js index 6e243ef04..7ee05dc01 100644 --- a/test/pullAtIndex/pullAtIndex.test.js +++ b/test/pullAtIndex/pullAtIndex.test.js @@ -5,9 +5,13 @@ test('Testing pullAtIndex', (t) => { //For more information on all the methods supported by tape //Please go to https://github.com/substack/tape t.true(typeof pullAtIndex === 'function', 'pullAtIndex is a Function'); + let myArray = ['a', 'b', 'c', 'd']; + let pulled = pullAtIndex(myArray, [1, 3]); + t.deepEqual(myArray, [ 'a', 'c' ], 'Pulls the given values'); + t.deepEqual(pulled, [ 'b', 'd' ], 'Pulls the given values'); //t.deepEqual(pullAtIndex(args..), 'Expected'); //t.equal(pullAtIndex(args..), 'Expected'); //t.false(pullAtIndex(args..), 'Expected'); //t.throws(pullAtIndex(args..), 'Expected'); t.end(); -}); \ No newline at end of file +}); diff --git a/test/pullAtValue/pullAtValue.test.js b/test/pullAtValue/pullAtValue.test.js index 887020c33..00e22c122 100644 --- a/test/pullAtValue/pullAtValue.test.js +++ b/test/pullAtValue/pullAtValue.test.js @@ -5,9 +5,13 @@ test('Testing pullAtValue', (t) => { //For more information on all the methods supported by tape //Please go to https://github.com/substack/tape t.true(typeof pullAtValue === 'function', 'pullAtValue is a Function'); + let myArray = ['a', 'b', 'c', 'd']; + let pulled = pullAtValue(myArray, ['b', 'd']); + t.deepEqual(myArray, [ 'a', 'c' ], 'Pulls the specified values'); + t.deepEqual(pulled, [ 'b', 'd' ], 'Pulls the specified values'); //t.deepEqual(pullAtValue(args..), 'Expected'); //t.equal(pullAtValue(args..), 'Expected'); //t.false(pullAtValue(args..), 'Expected'); //t.throws(pullAtValue(args..), 'Expected'); t.end(); -}); \ No newline at end of file +}); diff --git a/test/pullBy/pullBy.test.js b/test/pullBy/pullBy.test.js index 47d00a694..29082d3e0 100644 --- a/test/pullBy/pullBy.test.js +++ b/test/pullBy/pullBy.test.js @@ -5,9 +5,12 @@ test('Testing pullBy', (t) => { //For more information on all the methods supported by tape //Please go to https://github.com/substack/tape t.true(typeof pullBy === 'function', 'pullBy is a Function'); + var myArray = [{ x: 1 }, { x: 2 }, { x: 3 }, { x: 1 }]; + pullBy(myArray, [{ x: 1 }, { x: 3 }], o => o.x); + t.deepEqual(myArray, [{ x: 2 }], 'Pulls the specified values'); //t.deepEqual(pullBy(args..), 'Expected'); //t.equal(pullBy(args..), 'Expected'); //t.false(pullBy(args..), 'Expected'); //t.throws(pullBy(args..), 'Expected'); t.end(); -}); \ No newline at end of file +}); diff --git a/test/testlog b/test/testlog index b5aa7ffa1..6ec8fe5f5 100644 --- a/test/testlog +++ b/test/testlog @@ -1,4 +1,4 @@ -Test log for: Sun Feb 04 2018 20:56:18 GMT+0200 (GTB Standard Time) +Test log for: Sun Feb 04 2018 21:02:13 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 @@ -1144,18 +1144,24 @@ Test log for: Sun Feb 04 2018 20:56:18 GMT+0200 (GTB Standard Time) Testing pull √ pull is a Function + √ Pulls the specified values Testing pullAtIndex √ pullAtIndex is a Function + √ Pulls the given values + √ Pulls the given values Testing pullAtValue √ pullAtValue is a Function + √ Pulls the specified values + √ Pulls the specified values Testing pullBy √ pullBy is a Function + √ Pulls the specified values Testing quickSort @@ -1718,8 +1724,8 @@ Test log for: Sun Feb 04 2018 20:56:18 GMT+0200 (GTB Standard Time) √ Works with multiple promises - total: 825 - passing: 825 - duration: 2.4s + total: 831 + passing: 831 + duration: 2.5s