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();
|
||||
});
|
||||
Reference in New Issue
Block a user