From 7a457af1f9f14950d7c682f83861d5eef03fb87c Mon Sep 17 00:00:00 2001 From: 30secondsofcode <30secondsofcode@gmail.com> Date: Mon, 26 Feb 2018 10:20:51 +0000 Subject: [PATCH] Travis build: 1738 [custom] --- test/nest/nest.js | 5 +++++ test/nest/nest.test.js | 13 +++++++++++++ test/testlog | 10 +++++++--- test/tomorrow/tomorrow.js | 7 ++++--- 4 files changed, 29 insertions(+), 6 deletions(-) create mode 100644 test/nest/nest.js create mode 100644 test/nest/nest.test.js diff --git a/test/nest/nest.js b/test/nest/nest.js new file mode 100644 index 000000000..4afb092bd --- /dev/null +++ b/test/nest/nest.js @@ -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; \ No newline at end of file diff --git a/test/nest/nest.test.js b/test/nest/nest.test.js new file mode 100644 index 000000000..f3b177255 --- /dev/null +++ b/test/nest/nest.test.js @@ -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(); +}); \ No newline at end of file diff --git a/test/testlog b/test/testlog index 1a2c87d70..de9b84a0a 100644 --- a/test/testlog +++ b/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 > 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 diff --git a/test/tomorrow/tomorrow.js b/test/tomorrow/tomorrow.js index 81595a444..d177e0f9a 100644 --- a/test/tomorrow/tomorrow.js +++ b/test/tomorrow/tomorrow.js @@ -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; \ No newline at end of file