Travis build: 1738 [custom]
This commit is contained in:
5
test/nest/nest.js
Normal file
5
test/nest/nest.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
const nest = (items, id = null, link = 'parent_id') =>
|
||||||
|
items
|
||||||
|
.filter(item => item[link] === id)
|
||||||
|
.map(item => ({ ...item, children: nest(items, item.id) }));
|
||||||
|
module.exports = nest;
|
||||||
13
test/nest/nest.test.js
Normal file
13
test/nest/nest.test.js
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
const test = require('tape');
|
||||||
|
const nest = require('./nest.js');
|
||||||
|
|
||||||
|
test('Testing nest', (t) => {
|
||||||
|
//For more information on all the methods supported by tape
|
||||||
|
//Please go to https://github.com/substack/tape
|
||||||
|
t.true(typeof nest === 'function', 'nest is a Function');
|
||||||
|
//t.deepEqual(nest(args..), 'Expected');
|
||||||
|
//t.equal(nest(args..), 'Expected');
|
||||||
|
//t.false(nest(args..), 'Expected');
|
||||||
|
//t.throws(nest(args..), 'Expected');
|
||||||
|
t.end();
|
||||||
|
});
|
||||||
10
test/testlog
10
test/testlog
@ -1,4 +1,4 @@
|
|||||||
Test log for: Sun Feb 25 2018 20:27:15 GMT+0000 (UTC)
|
Test log for: Mon Feb 26 2018 10:20:44 GMT+0000 (UTC)
|
||||||
|
|
||||||
> 30-seconds-of-code@0.0.2 test /home/travis/build/Chalarangelo/30-seconds-of-code
|
> 30-seconds-of-code@0.0.2 test /home/travis/build/Chalarangelo/30-seconds-of-code
|
||||||
> tape test/**/*.test.js | tap-spec
|
> tape test/**/*.test.js | tap-spec
|
||||||
@ -1117,6 +1117,10 @@ Test log for: Sun Feb 25 2018 20:27:15 GMT+0000 (UTC)
|
|||||||
✔ negate is a Function
|
✔ negate is a Function
|
||||||
✔ Negates a predicate function
|
✔ Negates a predicate function
|
||||||
|
|
||||||
|
Testing nest
|
||||||
|
|
||||||
|
✔ nest is a Function
|
||||||
|
|
||||||
Testing none
|
Testing none
|
||||||
|
|
||||||
✔ none is a Function
|
✔ none is a Function
|
||||||
@ -1923,8 +1927,8 @@ Test log for: Sun Feb 25 2018 20:27:15 GMT+0000 (UTC)
|
|||||||
✔ Works with multiple promises
|
✔ Works with multiple promises
|
||||||
|
|
||||||
|
|
||||||
total: 979
|
total: 980
|
||||||
passing: 979
|
passing: 980
|
||||||
duration: 2.3s
|
duration: 2.3s
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,9 @@
|
|||||||
const tomorrow = () => {
|
const tomorrow = (long = false) => {
|
||||||
let t = new Date();
|
let t = new Date();
|
||||||
t.setDate(t.getDate() + 1);
|
t.setDate(t.getDate() + 1);
|
||||||
return `${String(t.getMonth() + 1).padStart(2, '0')}-${String(
|
const ret = `${t.getFullYear()}-${String(t.getMonth() + 1).padStart(2, '0')}-${String(
|
||||||
t.getDate()
|
t.getDate()
|
||||||
).padStart(2, '0')}-${t.getFullYear()}`;
|
).padStart(2, '0')}`;
|
||||||
|
return !long ? ret : `${ret}T00:00:00`;
|
||||||
};
|
};
|
||||||
module.exports = tomorrow;
|
module.exports = tomorrow;
|
||||||
Reference in New Issue
Block a user