ran npm run tdd & generated TDD
This commit is contained in:
9
test/pullAtIndex/pullAtIndex.js
Normal file
9
test/pullAtIndex/pullAtIndex.js
Normal file
@ -0,0 +1,9 @@
|
||||
module.exports = (arr, pullArr) => {
|
||||
let removed = [];
|
||||
let pulled = arr
|
||||
.map((v, i) => (pullArr.includes(i) ? removed.push(v) : v))
|
||||
.filter((v, i) => !pullArr.includes(i));
|
||||
arr.length = 0;
|
||||
pulled.forEach(v => arr.push(v));
|
||||
return removed;
|
||||
};
|
||||
13
test/pullAtIndex/pullAtIndex.test.js
Normal file
13
test/pullAtIndex/pullAtIndex.test.js
Normal file
@ -0,0 +1,13 @@
|
||||
const test = require('tape');
|
||||
const pullAtIndex = require('./pullAtIndex.js');
|
||||
|
||||
test('Testing pullAtIndex', (t) => {
|
||||
//For more information on all the methods supported by tape
|
||||
//Please go to https://github.com/substack/tape
|
||||
t.true(typeof pullAtIndex === 'function', 'pullAtIndex is a Function');
|
||||
//t.deepEqual(pullAtIndex(args..), 'Expected');
|
||||
//t.equal(pullAtIndex(args..), 'Expected');
|
||||
//t.false(pullAtIndex(args..), 'Expected');
|
||||
//t.throws(pullAtIndex(args..), 'Expected');
|
||||
t.end();
|
||||
});
|
||||
Reference in New Issue
Block a user