Travis build: 1358 [cron]
This commit is contained in:
2
test/castArray/castArray.js
Normal file
2
test/castArray/castArray.js
Normal file
@ -0,0 +1,2 @@
|
||||
const castArray = val => (Array.isArray(val) ? val : [val]);
|
||||
module.exports = castArray
|
||||
13
test/castArray/castArray.test.js
Normal file
13
test/castArray/castArray.test.js
Normal file
@ -0,0 +1,13 @@
|
||||
const test = require('tape');
|
||||
const castArray = require('./castArray.js');
|
||||
|
||||
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(args..), 'Expected');
|
||||
//t.equal(castArray(args..), 'Expected');
|
||||
//t.false(castArray(args..), 'Expected');
|
||||
//t.throws(castArray(args..), 'Expected');
|
||||
t.end();
|
||||
});
|
||||
8
test/deepClone/deepClone.js
Normal file
8
test/deepClone/deepClone.js
Normal file
@ -0,0 +1,8 @@
|
||||
const deepClone = obj => {
|
||||
let clone = Object.assign({}, obj);
|
||||
Object.keys(clone).forEach(
|
||||
key => (clone[key] = typeof obj[key] === 'object' ? deepClone(obj[key]) : obj[key])
|
||||
);
|
||||
return clone;
|
||||
};
|
||||
module.exports = deepClone
|
||||
13
test/deepClone/deepClone.test.js
Normal file
13
test/deepClone/deepClone.test.js
Normal file
@ -0,0 +1,13 @@
|
||||
const test = require('tape');
|
||||
const deepClone = require('./deepClone.js');
|
||||
|
||||
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');
|
||||
//t.deepEqual(deepClone(args..), 'Expected');
|
||||
//t.equal(deepClone(args..), 'Expected');
|
||||
//t.false(deepClone(args..), 'Expected');
|
||||
//t.throws(deepClone(args..), 'Expected');
|
||||
t.end();
|
||||
});
|
||||
2
test/findKey/findKey.js
Normal file
2
test/findKey/findKey.js
Normal file
@ -0,0 +1,2 @@
|
||||
const findKey = (obj, fn) => Object.keys(obj).find(key => fn(obj[key], key, obj));
|
||||
module.exports = findKey
|
||||
13
test/findKey/findKey.test.js
Normal file
13
test/findKey/findKey.test.js
Normal file
@ -0,0 +1,13 @@
|
||||
const test = require('tape');
|
||||
const findKey = require('./findKey.js');
|
||||
|
||||
test('Testing findKey', (t) => {
|
||||
//For more information on all the methods supported by tape
|
||||
//Please go to https://github.com/substack/tape
|
||||
t.true(typeof findKey === 'function', 'findKey is a Function');
|
||||
//t.deepEqual(findKey(args..), 'Expected');
|
||||
//t.equal(findKey(args..), 'Expected');
|
||||
//t.false(findKey(args..), 'Expected');
|
||||
//t.throws(findKey(args..), 'Expected');
|
||||
t.end();
|
||||
});
|
||||
5
test/findLastKey/findLastKey.js
Normal file
5
test/findLastKey/findLastKey.js
Normal file
@ -0,0 +1,5 @@
|
||||
const findLastKey = (obj, fn) =>
|
||||
Object.keys(obj)
|
||||
.reverse()
|
||||
.find(key => fn(obj[key], key, obj));
|
||||
module.exports = findLastKey
|
||||
13
test/findLastKey/findLastKey.test.js
Normal file
13
test/findLastKey/findLastKey.test.js
Normal file
@ -0,0 +1,13 @@
|
||||
const test = require('tape');
|
||||
const findLastKey = require('./findLastKey.js');
|
||||
|
||||
test('Testing findLastKey', (t) => {
|
||||
//For more information on all the methods supported by tape
|
||||
//Please go to https://github.com/substack/tape
|
||||
t.true(typeof findLastKey === 'function', 'findLastKey is a Function');
|
||||
//t.deepEqual(findLastKey(args..), 'Expected');
|
||||
//t.equal(findLastKey(args..), 'Expected');
|
||||
//t.false(findLastKey(args..), 'Expected');
|
||||
//t.throws(findLastKey(args..), 'Expected');
|
||||
t.end();
|
||||
});
|
||||
@ -1,6 +1,8 @@
|
||||
const invertKeyValues = obj =>
|
||||
const invertKeyValues = (obj, fn) =>
|
||||
Object.keys(obj).reduce((acc, key) => {
|
||||
acc[obj[key]] = key;
|
||||
const val = fn ? fn(obj[key]) : obj[key];
|
||||
acc[val] = acc[val] || [];
|
||||
acc[val].push(key);
|
||||
return acc;
|
||||
}, {});
|
||||
module.exports = invertKeyValues
|
||||
2
test/isEmpty/isEmpty.js
Normal file
2
test/isEmpty/isEmpty.js
Normal file
@ -0,0 +1,2 @@
|
||||
const isEmpty = val => val == null || !(Object.keys(val) || val).length;
|
||||
module.exports = isEmpty
|
||||
13
test/isEmpty/isEmpty.test.js
Normal file
13
test/isEmpty/isEmpty.test.js
Normal file
@ -0,0 +1,13 @@
|
||||
const test = require('tape');
|
||||
const isEmpty = require('./isEmpty.js');
|
||||
|
||||
test('Testing isEmpty', (t) => {
|
||||
//For more information on all the methods supported by tape
|
||||
//Please go to https://github.com/substack/tape
|
||||
t.true(typeof isEmpty === 'function', 'isEmpty is a Function');
|
||||
//t.deepEqual(isEmpty(args..), 'Expected');
|
||||
//t.equal(isEmpty(args..), 'Expected');
|
||||
//t.false(isEmpty(args..), 'Expected');
|
||||
//t.throws(isEmpty(args..), 'Expected');
|
||||
t.end();
|
||||
});
|
||||
2
test/isObjectLike/isObjectLike.js
Normal file
2
test/isObjectLike/isObjectLike.js
Normal file
@ -0,0 +1,2 @@
|
||||
const isObjectLike = val => val !== null && typeof val === 'object';
|
||||
module.exports = isObjectLike
|
||||
13
test/isObjectLike/isObjectLike.test.js
Normal file
13
test/isObjectLike/isObjectLike.test.js
Normal file
@ -0,0 +1,13 @@
|
||||
const test = require('tape');
|
||||
const isObjectLike = require('./isObjectLike.js');
|
||||
|
||||
test('Testing isObjectLike', (t) => {
|
||||
//For more information on all the methods supported by tape
|
||||
//Please go to https://github.com/substack/tape
|
||||
t.true(typeof isObjectLike === 'function', 'isObjectLike is a Function');
|
||||
//t.deepEqual(isObjectLike(args..), 'Expected');
|
||||
//t.equal(isObjectLike(args..), 'Expected');
|
||||
//t.false(isObjectLike(args..), 'Expected');
|
||||
//t.throws(isObjectLike(args..), 'Expected');
|
||||
t.end();
|
||||
});
|
||||
3
test/matches/matches.js
Normal file
3
test/matches/matches.js
Normal file
@ -0,0 +1,3 @@
|
||||
const matches = (obj, source) =>
|
||||
Object.keys(source).every(key => obj.hasOwnProperty(key) && obj[key] === source[key]);
|
||||
module.exports = matches
|
||||
13
test/matches/matches.test.js
Normal file
13
test/matches/matches.test.js
Normal file
@ -0,0 +1,13 @@
|
||||
const test = require('tape');
|
||||
const matches = require('./matches.js');
|
||||
|
||||
test('Testing matches', (t) => {
|
||||
//For more information on all the methods supported by tape
|
||||
//Please go to https://github.com/substack/tape
|
||||
t.true(typeof matches === 'function', 'matches is a Function');
|
||||
//t.deepEqual(matches(args..), 'Expected');
|
||||
//t.equal(matches(args..), 'Expected');
|
||||
//t.false(matches(args..), 'Expected');
|
||||
//t.throws(matches(args..), 'Expected');
|
||||
t.end();
|
||||
});
|
||||
8
test/matchesWith/matchesWith.js
Normal file
8
test/matchesWith/matchesWith.js
Normal file
@ -0,0 +1,8 @@
|
||||
const matchesWith = (obj, source, fn) =>
|
||||
Object.keys(source).every(
|
||||
key =>
|
||||
obj.hasOwnProperty(key) && fn
|
||||
? fn(obj[key], source[key], key, obj, source)
|
||||
: obj[key] == source[key]
|
||||
);
|
||||
module.exports = matchesWith
|
||||
13
test/matchesWith/matchesWith.test.js
Normal file
13
test/matchesWith/matchesWith.test.js
Normal file
@ -0,0 +1,13 @@
|
||||
const test = require('tape');
|
||||
const matchesWith = require('./matchesWith.js');
|
||||
|
||||
test('Testing matchesWith', (t) => {
|
||||
//For more information on all the methods supported by tape
|
||||
//Please go to https://github.com/substack/tape
|
||||
t.true(typeof matchesWith === 'function', 'matchesWith is a Function');
|
||||
//t.deepEqual(matchesWith(args..), 'Expected');
|
||||
//t.equal(matchesWith(args..), 'Expected');
|
||||
//t.false(matchesWith(args..), 'Expected');
|
||||
//t.throws(matchesWith(args..), 'Expected');
|
||||
t.end();
|
||||
});
|
||||
2
test/nthArg/nthArg.js
Normal file
2
test/nthArg/nthArg.js
Normal file
@ -0,0 +1,2 @@
|
||||
const nthArg = n => (...args) => args.slice(n)[0];
|
||||
module.exports = nthArg
|
||||
13
test/nthArg/nthArg.test.js
Normal file
13
test/nthArg/nthArg.test.js
Normal file
@ -0,0 +1,13 @@
|
||||
const test = require('tape');
|
||||
const nthArg = require('./nthArg.js');
|
||||
|
||||
test('Testing nthArg', (t) => {
|
||||
//For more information on all the methods supported by tape
|
||||
//Please go to https://github.com/substack/tape
|
||||
t.true(typeof nthArg === 'function', 'nthArg is a Function');
|
||||
//t.deepEqual(nthArg(args..), 'Expected');
|
||||
//t.equal(nthArg(args..), 'Expected');
|
||||
//t.false(nthArg(args..), 'Expected');
|
||||
//t.throws(nthArg(args..), 'Expected');
|
||||
t.end();
|
||||
});
|
||||
2
test/over/over.js
Normal file
2
test/over/over.js
Normal file
@ -0,0 +1,2 @@
|
||||
const over = (...fns) => (...args) => fns.map(fn => fn.apply(null, args));
|
||||
module.exports = over
|
||||
13
test/over/over.test.js
Normal file
13
test/over/over.test.js
Normal file
@ -0,0 +1,13 @@
|
||||
const test = require('tape');
|
||||
const over = require('./over.js');
|
||||
|
||||
test('Testing over', (t) => {
|
||||
//For more information on all the methods supported by tape
|
||||
//Please go to https://github.com/substack/tape
|
||||
t.true(typeof over === 'function', 'over is a Function');
|
||||
//t.deepEqual(over(args..), 'Expected');
|
||||
//t.equal(over(args..), 'Expected');
|
||||
//t.false(over(args..), 'Expected');
|
||||
//t.throws(over(args..), 'Expected');
|
||||
t.end();
|
||||
});
|
||||
74
test/testlog
74
test/testlog
@ -1,4 +1,4 @@
|
||||
Test log for: Mon Jan 22 2018 20:11:29 GMT+0000 (UTC)
|
||||
Test log for: Tue Jan 23 2018 20:11:47 GMT+0000 (UTC)
|
||||
|
||||
> 30-seconds-of-code@0.0.1 test /home/travis/build/Chalarangelo/30-seconds-of-code
|
||||
> tape test/**/*.test.js | tap-spec
|
||||
@ -98,6 +98,10 @@ Test log for: Mon Jan 22 2018 20:11:29 GMT+0000 (UTC)
|
||||
✔ capitalizeEveryWord is a Function
|
||||
✔ Capitalizes the first letter of every word in a string
|
||||
|
||||
Testing castArray
|
||||
|
||||
✔ castArray is a Function
|
||||
|
||||
Testing chainAsync
|
||||
|
||||
✔ chainAsync is a Function
|
||||
@ -200,6 +204,10 @@ Test log for: Mon Jan 22 2018 20:11:29 GMT+0000 (UTC)
|
||||
|
||||
✔ decapitalize is a Function
|
||||
|
||||
Testing deepClone
|
||||
|
||||
✔ deepClone is a Function
|
||||
|
||||
Testing deepFlatten
|
||||
|
||||
✔ deepFlatten is a Function
|
||||
@ -320,10 +328,18 @@ Test log for: Mon Jan 22 2018 20:11:29 GMT+0000 (UTC)
|
||||
✔ filterNonUnique is a Function
|
||||
✔ Filters out the non-unique values in an array
|
||||
|
||||
Testing findKey
|
||||
|
||||
✔ findKey is a Function
|
||||
|
||||
Testing findLast
|
||||
|
||||
✔ findLast is a Function
|
||||
|
||||
Testing findLastKey
|
||||
|
||||
✔ findLastKey is a Function
|
||||
|
||||
Testing flatten
|
||||
|
||||
✔ flatten is a Function
|
||||
@ -528,7 +544,17 @@ Test log for: Mon Jan 22 2018 20:11:29 GMT+0000 (UTC)
|
||||
Testing invertKeyValues
|
||||
|
||||
✔ invertKeyValues is a Function
|
||||
✔ Inverts the key-value pairs of an object
|
||||
|
||||
✖ Inverts the key-value pairs of an object
|
||||
-------------------------------------------
|
||||
operator: deepEqual
|
||||
expected: |-
|
||||
{ 20: 'age', John: 'name' }
|
||||
actual: |-
|
||||
{ 20: [ 'age' ], John: [ 'name' ] }
|
||||
at: Test.test (/home/travis/build/Chalarangelo/30-seconds-of-code/test/invertKeyValues/invertKeyValues.test.js:8:4)
|
||||
stack: |-
|
||||
|
||||
|
||||
Testing is
|
||||
|
||||
@ -570,6 +596,10 @@ Test log for: Mon Jan 22 2018 20:11:29 GMT+0000 (UTC)
|
||||
✔ isDivisible is a Function
|
||||
✔ The number 6 is divisible by 3
|
||||
|
||||
Testing isEmpty
|
||||
|
||||
✔ isEmpty is a Function
|
||||
|
||||
Testing isEven
|
||||
|
||||
✔ isEven is a Function
|
||||
@ -617,6 +647,10 @@ Test log for: Mon Jan 22 2018 20:11:29 GMT+0000 (UTC)
|
||||
✔ isObject({ a:1 }) is a object
|
||||
✔ isObject(true) is not a object
|
||||
|
||||
Testing isObjectLike
|
||||
|
||||
✔ isObjectLike is a Function
|
||||
|
||||
Testing isPlainObject
|
||||
|
||||
✔ isPlainObject is a Function
|
||||
@ -769,6 +803,14 @@ Test log for: Mon Jan 22 2018 20:11:29 GMT+0000 (UTC)
|
||||
✔ Replaces all but the last num of characters with the specified mask character
|
||||
✔ Replaces all but the last num of characters with the specified mask character
|
||||
|
||||
Testing matches
|
||||
|
||||
✔ matches is a Function
|
||||
|
||||
Testing matchesWith
|
||||
|
||||
✔ matchesWith is a Function
|
||||
|
||||
Testing maxBy
|
||||
|
||||
✔ maxBy is a Function
|
||||
@ -808,6 +850,10 @@ Test log for: Mon Jan 22 2018 20:11:29 GMT+0000 (UTC)
|
||||
✔ negate is a Function
|
||||
✔ Negates a predicate function
|
||||
|
||||
Testing nthArg
|
||||
|
||||
✔ nthArg is a Function
|
||||
|
||||
Testing nthElement
|
||||
|
||||
✔ nthElement is a Function
|
||||
@ -858,6 +904,10 @@ Test log for: Mon Jan 22 2018 20:11:29 GMT+0000 (UTC)
|
||||
✔ Returns a sorted array of objects ordered by properties and orders.
|
||||
✔ Returns a sorted array of objects ordered by properties and orders.
|
||||
|
||||
Testing over
|
||||
|
||||
✔ over is a Function
|
||||
|
||||
Testing palindrome
|
||||
|
||||
✔ palindrome is a Function
|
||||
@ -1296,9 +1346,23 @@ Test log for: Mon Jan 22 2018 20:11:29 GMT+0000 (UTC)
|
||||
✔ zipObject(string) throws an error
|
||||
✔ zipObject(test, string) throws an error
|
||||
|
||||
Testing zipWith
|
||||
|
||||
total: 563
|
||||
passing: 563
|
||||
duration: 314ms
|
||||
✔ zipWith is a Function
|
||||
|
||||
|
||||
|
||||
Failed Tests: There was 1 failure
|
||||
|
||||
Testing invertKeyValues
|
||||
|
||||
✖ Inverts the key-value pairs of an object
|
||||
|
||||
|
||||
total: 574
|
||||
passing: 573
|
||||
failing: 1
|
||||
duration: 440ms
|
||||
|
||||
|
||||
undefined
|
||||
@ -1,2 +1,8 @@
|
||||
const tomorrow = () => new Date(new Date().getTime() + 86400000).toISOString().split('T')[0];
|
||||
const tomorrow = () => {
|
||||
let t = new Date();
|
||||
t.setDate(t.getDate() + 1);
|
||||
return `${t.getFullYear()}-${String(t.getMonth() + 1).padStart(2, '0')}-${String(
|
||||
t.getDate()
|
||||
).padStart(2, '0')}`;
|
||||
};
|
||||
module.exports = tomorrow
|
||||
11
test/zipWith/zipWith.js
Normal file
11
test/zipWith/zipWith.js
Normal file
@ -0,0 +1,11 @@
|
||||
const zipWith = (...arrays) => {
|
||||
const length = arrays.length;
|
||||
let fn = length > 1 ? arrays[length - 1] : undefined;
|
||||
fn = typeof fn == 'function' ? (arrays.pop(), fn) : undefined;
|
||||
const maxLength = Math.max(...arrays.map(x => x.length));
|
||||
const result = Array.from({ length: maxLength }).map((_, i) => {
|
||||
return Array.from({ length: arrays.length }, (_, k) => arrays[k][i]);
|
||||
});
|
||||
return fn ? result.map(arr => fn(...arr)) : result;
|
||||
};
|
||||
module.exports = zipWith
|
||||
13
test/zipWith/zipWith.test.js
Normal file
13
test/zipWith/zipWith.test.js
Normal file
@ -0,0 +1,13 @@
|
||||
const test = require('tape');
|
||||
const zipWith = require('./zipWith.js');
|
||||
|
||||
test('Testing zipWith', (t) => {
|
||||
//For more information on all the methods supported by tape
|
||||
//Please go to https://github.com/substack/tape
|
||||
t.true(typeof zipWith === 'function', 'zipWith is a Function');
|
||||
//t.deepEqual(zipWith(args..), 'Expected');
|
||||
//t.equal(zipWith(args..), 'Expected');
|
||||
//t.false(zipWith(args..), 'Expected');
|
||||
//t.throws(zipWith(args..), 'Expected');
|
||||
t.end();
|
||||
});
|
||||
Reference in New Issue
Block a user