More tests

This commit is contained in:
Angelos Chalaris
2018-01-24 17:49:09 +02:00
parent 79a70885ad
commit 3e3982a0e4
6 changed files with 39 additions and 9 deletions

View File

@ -5,6 +5,11 @@ test('Testing castArray', (t) => {
//For more information on all the methods supported by tape //For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape //Please go to https://github.com/substack/tape
t.true(typeof castArray === 'function', 'castArray is a Function'); 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.deepEqual(castArray(args..), 'Expected');
//t.equal(castArray(args..), 'Expected'); //t.equal(castArray(args..), 'Expected');
//t.false(castArray(args..), 'Expected'); //t.false(castArray(args..), 'Expected');

View File

@ -5,6 +5,8 @@ test('Testing cloneRegExp', (t) => {
//For more information on all the methods supported by tape //For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape //Please go to https://github.com/substack/tape
t.true(typeof cloneRegExp === 'function', 'cloneRegExp is a Function'); 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.deepEqual(cloneRegExp(args..), 'Expected');
//t.equal(cloneRegExp(args..), 'Expected'); //t.equal(cloneRegExp(args..), 'Expected');
//t.false(cloneRegExp(args..), 'Expected'); //t.false(cloneRegExp(args..), 'Expected');

View File

@ -5,6 +5,10 @@ test('Testing composeRight', (t) => {
//For more information on all the methods supported by tape //For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape //Please go to https://github.com/substack/tape
t.true(typeof composeRight === 'function', 'composeRight is a Function'); 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.deepEqual(composeRight(args..), 'Expected');
//t.equal(composeRight(args..), 'Expected'); //t.equal(composeRight(args..), 'Expected');
//t.false(composeRight(args..), 'Expected'); //t.false(composeRight(args..), 'Expected');

View File

@ -5,6 +5,10 @@ test('Testing deepClone', (t) => {
//For more information on all the methods supported by tape //For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape //Please go to https://github.com/substack/tape
t.true(typeof deepClone === 'function', 'deepClone is a Function'); 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.deepEqual(deepClone(args..), 'Expected');
//t.equal(deepClone(args..), 'Expected'); //t.equal(deepClone(args..), 'Expected');
//t.false(deepClone(args..), 'Expected'); //t.false(deepClone(args..), 'Expected');

View File

@ -5,6 +5,10 @@ test('Testing shallowClone', (t) => {
//For more information on all the methods supported by tape //For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape //Please go to https://github.com/substack/tape
t.true(typeof shallowClone === 'function', 'shallowClone is a Function'); 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.deepEqual(shallowClone(args..), 'Expected');
//t.equal(shallowClone(args..), 'Expected'); //t.equal(shallowClone(args..), 'Expected');
//t.false(shallowClone(args..), 'Expected'); //t.false(shallowClone(args..), 'Expected');

View File

@ -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 > 30-seconds-of-code@0.0.1 test G:\My Files\git Repositories\30-seconds-of-code
> tape test/**/*.test.js | tap-spec > 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 Testing castArray
√ castArray is a Function √ 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 Testing chainAsync
@ -118,6 +123,7 @@ Test log for: Wed Jan 24 2018 17:37:28 GMT+0200 (GTB Standard Time)
Testing cloneRegExp Testing cloneRegExp
√ cloneRegExp is a Function √ cloneRegExp is a Function
√ Clones regular expressions properly
Testing coalesce Testing coalesce
@ -154,6 +160,7 @@ Test log for: Wed Jan 24 2018 17:37:28 GMT+0200 (GTB Standard Time)
Testing composeRight Testing composeRight
√ composeRight is a Function √ composeRight is a Function
√ Performs left-to-right function composition
Testing copyToClipboard Testing copyToClipboard
@ -197,6 +204,8 @@ Test log for: Wed Jan 24 2018 17:37:28 GMT+0200 (GTB Standard Time)
Testing deepClone Testing deepClone
√ deepClone is a Function √ deepClone is a Function
√ Shallow cloning works
√ Deep cloning works
Testing deepFlatten Testing deepFlatten
@ -1124,6 +1133,8 @@ Test log for: Wed Jan 24 2018 17:37:28 GMT+0200 (GTB Standard Time)
Testing shallowClone Testing shallowClone
√ shallowClone is a Function √ shallowClone is a Function
√ Shallow cloning works
√ Does not clone deeply
Testing show 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 √ zipWith is a Function
total: 627 total: 638
passing: 627 passing: 638
duration: 419ms duration: 418ms