diff --git a/test/castArray/castArray.test.js b/test/castArray/castArray.test.js index 59d5d7c28..ed251de5a 100644 --- a/test/castArray/castArray.test.js +++ b/test/castArray/castArray.test.js @@ -5,9 +5,14 @@ test('Testing castArray', (t) => { //For more information on all the methods supported by tape //Please go to https://github.com/substack/tape t.true(typeof castArray === 'function', 'castArray is a Function'); + t.deepEqual(castArray(1), [1], 'Works for single values'); + t.deepEqual(castArray([1]), [1], 'Works for arrays with one value'); + t.deepEqual(castArray([1,2,3]), [1,2,3], 'Works for arrays with multiple value'); + t.deepEqual(castArray('test'), ['test'], 'Works for strings'); + t.deepEqual(castArray({}), [{}], 'Works for objects'); //t.deepEqual(castArray(args..), 'Expected'); //t.equal(castArray(args..), 'Expected'); //t.false(castArray(args..), 'Expected'); //t.throws(castArray(args..), 'Expected'); t.end(); -}); \ No newline at end of file +}); diff --git a/test/cloneRegExp/cloneRegExp.test.js b/test/cloneRegExp/cloneRegExp.test.js index 2fb7f7b82..787c47fff 100644 --- a/test/cloneRegExp/cloneRegExp.test.js +++ b/test/cloneRegExp/cloneRegExp.test.js @@ -5,9 +5,11 @@ test('Testing cloneRegExp', (t) => { //For more information on all the methods supported by tape //Please go to https://github.com/substack/tape t.true(typeof cloneRegExp === 'function', 'cloneRegExp is a Function'); + const rgTest = /./g; + t.notEqual(cloneRegExp(rgTest), rgTest, 'Clones regular expressions properly'); //t.deepEqual(cloneRegExp(args..), 'Expected'); //t.equal(cloneRegExp(args..), 'Expected'); //t.false(cloneRegExp(args..), 'Expected'); //t.throws(cloneRegExp(args..), 'Expected'); t.end(); -}); \ No newline at end of file +}); diff --git a/test/composeRight/composeRight.test.js b/test/composeRight/composeRight.test.js index c96397e9f..be6a1ee90 100644 --- a/test/composeRight/composeRight.test.js +++ b/test/composeRight/composeRight.test.js @@ -5,9 +5,13 @@ test('Testing composeRight', (t) => { //For more information on all the methods supported by tape //Please go to https://github.com/substack/tape t.true(typeof composeRight === 'function', 'composeRight is a Function'); + const add = (x, y) => x + y; + const square = x => x * x; + const addAndSquare = composeRight(add, square); + t.equal(addAndSquare(1, 2), 9, "Performs left-to-right function composition"); //t.deepEqual(composeRight(args..), 'Expected'); //t.equal(composeRight(args..), 'Expected'); //t.false(composeRight(args..), 'Expected'); //t.throws(composeRight(args..), 'Expected'); t.end(); -}); \ No newline at end of file +}); diff --git a/test/deepClone/deepClone.test.js b/test/deepClone/deepClone.test.js index a94eabcda..2098a1acf 100644 --- a/test/deepClone/deepClone.test.js +++ b/test/deepClone/deepClone.test.js @@ -5,9 +5,13 @@ test('Testing deepClone', (t) => { //For more information on all the methods supported by tape //Please go to https://github.com/substack/tape t.true(typeof deepClone === 'function', 'deepClone is a Function'); + const a = { foo: 'bar', obj: { a: 1, b: 2 } }; + const b = deepClone(a); + t.notEqual(a, b, 'Shallow cloning works'); + t.notEqual(a.obj, b.obj, 'Deep cloning works'); //t.deepEqual(deepClone(args..), 'Expected'); //t.equal(deepClone(args..), 'Expected'); //t.false(deepClone(args..), 'Expected'); //t.throws(deepClone(args..), 'Expected'); t.end(); -}); \ No newline at end of file +}); diff --git a/test/shallowClone/shallowClone.test.js b/test/shallowClone/shallowClone.test.js index b62b37998..9f0885344 100644 --- a/test/shallowClone/shallowClone.test.js +++ b/test/shallowClone/shallowClone.test.js @@ -5,9 +5,13 @@ test('Testing shallowClone', (t) => { //For more information on all the methods supported by tape //Please go to https://github.com/substack/tape t.true(typeof shallowClone === 'function', 'shallowClone is a Function'); + const a = { foo: 'bar', obj: { a: 1, b: 2 } }; + const b = shallowClone(a); + t.notEqual(a, b, 'Shallow cloning works'); + t.equal(a.obj, b.obj, 'Does not clone deeply'); //t.deepEqual(shallowClone(args..), 'Expected'); //t.equal(shallowClone(args..), 'Expected'); //t.false(shallowClone(args..), 'Expected'); //t.throws(shallowClone(args..), 'Expected'); t.end(); -}); \ No newline at end of file +}); diff --git a/test/testlog b/test/testlog index 3b1c8f3f5..cbe9a981c 100644 --- a/test/testlog +++ b/test/testlog @@ -1,4 +1,4 @@ -Test log for: Wed Jan 24 2018 17:37:28 GMT+0200 (GTB Standard Time) +Test log for: Wed Jan 24 2018 17:48:46 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 @@ -87,6 +87,11 @@ Test log for: Wed Jan 24 2018 17:37:28 GMT+0200 (GTB Standard Time) Testing castArray √ castArray is a Function + √ Works for single values + √ Works for arrays with one value + √ Works for arrays with multiple value + √ Works for strings + √ Works for objects Testing chainAsync @@ -118,6 +123,7 @@ Test log for: Wed Jan 24 2018 17:37:28 GMT+0200 (GTB Standard Time) Testing cloneRegExp √ cloneRegExp is a Function + √ Clones regular expressions properly Testing coalesce @@ -154,6 +160,7 @@ Test log for: Wed Jan 24 2018 17:37:28 GMT+0200 (GTB Standard Time) Testing composeRight √ composeRight is a Function + √ Performs left-to-right function composition Testing copyToClipboard @@ -197,6 +204,8 @@ Test log for: Wed Jan 24 2018 17:37:28 GMT+0200 (GTB Standard Time) Testing deepClone √ deepClone is a Function + √ Shallow cloning works + √ Deep cloning works Testing deepFlatten @@ -1124,6 +1133,8 @@ Test log for: Wed Jan 24 2018 17:37:28 GMT+0200 (GTB Standard Time) Testing shallowClone √ shallowClone is a Function + √ Shallow cloning works + √ Does not clone deeply Testing show @@ -1463,8 +1474,8 @@ Test log for: Wed Jan 24 2018 17:37:28 GMT+0200 (GTB Standard Time) √ zipWith is a Function - total: 627 - passing: 627 - duration: 419ms + total: 638 + passing: 638 + duration: 418ms