Travis build: 1738 [custom]

This commit is contained in:
30secondsofcode
2018-02-26 10:20:51 +00:00
parent 8c42f47d59
commit 7a457af1f9
4 changed files with 29 additions and 6 deletions

5
test/nest/nest.js Normal file
View 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
View 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();
});

View File

@ -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
> 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
✔ Negates a predicate function
Testing nest
✔ nest is a Function
Testing none
✔ 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
total: 979
passing: 979
total: 980
passing: 980
duration: 2.3s

View File

@ -1,8 +1,9 @@
const tomorrow = () => {
const tomorrow = (long = false) => {
let t = new Date();
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()
).padStart(2, '0')}-${t.getFullYear()}`;
).padStart(2, '0')}`;
return !long ? ret : `${ret}T00:00:00`;
};
module.exports = tomorrow;