Added some tests
This commit is contained in:
@ -13,5 +13,5 @@ const Pall = collectInto(Promise.all.bind(Promise));
|
||||
let p1 = Promise.resolve(1);
|
||||
let p2 = Promise.resolve(2);
|
||||
let p3 = new Promise(resolve => setTimeout(resolve, 2000, 3));
|
||||
Pall(p1, p2, p3).then(console.log);
|
||||
Pall(p1, p2, p3).then(console.log); // [1, 2, 3] (after about 2 seconds)
|
||||
```
|
||||
|
||||
@ -5,9 +5,14 @@ test('Testing collectInto', (t) => {
|
||||
//For more information on all the methods supported by tape
|
||||
//Please go to https://github.com/substack/tape
|
||||
t.true(typeof collectInto === 'function', 'collectInto is a Function');
|
||||
const Pall = collectInto(Promise.all.bind(Promise));
|
||||
let p1 = Promise.resolve(1);
|
||||
let p2 = Promise.resolve(2);
|
||||
let p3 = new Promise(resolve => setTimeout(resolve, 2000, 3));
|
||||
Pall(p1, p2, p3).then(function(val){ t.deepEqual(val, [1,2,3], 'Works with multiple promises')}, function(reason){});
|
||||
//t.deepEqual(collectInto(args..), 'Expected');
|
||||
//t.equal(collectInto(args..), 'Expected');
|
||||
//t.false(collectInto(args..), 'Expected');
|
||||
//t.throws(collectInto(args..), 'Expected');
|
||||
t.end();
|
||||
});
|
||||
});
|
||||
|
||||
@ -5,9 +5,11 @@ test('Testing countBy', (t) => {
|
||||
//For more information on all the methods supported by tape
|
||||
//Please go to https://github.com/substack/tape
|
||||
t.true(typeof countBy === 'function', 'countBy is a Function');
|
||||
t.deepEqual(countBy([6.1, 4.2, 6.3], Math.floor), {4: 1, 6: 2}, 'Works for functions');
|
||||
t.deepEqual(countBy(['one', 'two', 'three'], 'length'), {3: 2, 5: 1}, 'Works for property names');
|
||||
//t.deepEqual(countBy(args..), 'Expected');
|
||||
//t.equal(countBy(args..), 'Expected');
|
||||
//t.false(countBy(args..), 'Expected');
|
||||
//t.throws(countBy(args..), 'Expected');
|
||||
t.end();
|
||||
});
|
||||
});
|
||||
|
||||
@ -5,9 +5,11 @@ test('Testing decapitalize', (t) => {
|
||||
//For more information on all the methods supported by tape
|
||||
//Please go to https://github.com/substack/tape
|
||||
t.true(typeof decapitalize === 'function', 'decapitalize is a Function');
|
||||
t.equal(decapitalize('FooBar'), 'fooBar', 'Works with default parameter');
|
||||
t.equal(decapitalize('FooBar', true), 'fOOBAR', 'Works with second parameter set to true');
|
||||
//t.deepEqual(decapitalize(args..), 'Expected');
|
||||
//t.equal(decapitalize(args..), 'Expected');
|
||||
//t.false(decapitalize(args..), 'Expected');
|
||||
//t.throws(decapitalize(args..), 'Expected');
|
||||
t.end();
|
||||
});
|
||||
});
|
||||
|
||||
13
test/testlog
13
test/testlog
@ -1,4 +1,4 @@
|
||||
Test log for: Sun Jan 28 2018 16:28:45 GMT+0200 (GTB Standard Time)
|
||||
Test log for: Sun Jan 28 2018 16:40:59 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
|
||||
@ -186,6 +186,8 @@ Test log for: Sun Jan 28 2018 16:28:45 GMT+0200 (GTB Standard Time)
|
||||
Testing countBy
|
||||
|
||||
√ countBy is a Function
|
||||
√ Works for functions
|
||||
√ Works for property names
|
||||
|
||||
Testing countOccurrences
|
||||
|
||||
@ -221,6 +223,8 @@ Test log for: Sun Jan 28 2018 16:28:45 GMT+0200 (GTB Standard Time)
|
||||
Testing decapitalize
|
||||
|
||||
√ decapitalize is a Function
|
||||
√ Works with default parameter
|
||||
√ Works with second parameter set to true
|
||||
|
||||
Testing deepClone
|
||||
|
||||
@ -1601,10 +1605,11 @@ Test log for: Sun Jan 28 2018 16:28:45 GMT+0200 (GTB Standard Time)
|
||||
Testing zipWith
|
||||
|
||||
√ zipWith is a Function
|
||||
√ Works with multiple promises
|
||||
|
||||
|
||||
total: 716
|
||||
passing: 716
|
||||
duration: 1.1s
|
||||
total: 721
|
||||
passing: 721
|
||||
duration: 3.1s
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user