Added some tests
This commit is contained in:
8
test/rearg/rearg.js
Normal file
8
test/rearg/rearg.js
Normal file
@ -0,0 +1,8 @@
|
||||
const rearg = (fn, indexes) => (...args) =>
|
||||
fn(
|
||||
...args.reduce(
|
||||
(acc, val, i) => ((acc[indexes.indexOf(i)] = val), acc),
|
||||
Array.from({ length: indexes.length })
|
||||
)
|
||||
);
|
||||
module.exports = rearg
|
||||
13
test/rearg/rearg.test.js
Normal file
13
test/rearg/rearg.test.js
Normal file
@ -0,0 +1,13 @@
|
||||
const test = require('tape');
|
||||
const rearg = require('./rearg.js');
|
||||
|
||||
test('Testing rearg', (t) => {
|
||||
//For more information on all the methods supported by tape
|
||||
//Please go to https://github.com/substack/tape
|
||||
t.true(typeof rearg === 'function', 'rearg is a Function');
|
||||
//t.deepEqual(rearg(args..), 'Expected');
|
||||
//t.equal(rearg(args..), 'Expected');
|
||||
//t.false(rearg(args..), 'Expected');
|
||||
//t.throws(rearg(args..), 'Expected');
|
||||
t.end();
|
||||
});
|
||||
Reference in New Issue
Block a user