Migrated tests to jest
Used jest-codemods to migrate, will have to pass everything by hand before we can merge.
This commit is contained in:
@ -1,11 +0,0 @@
|
||||
const permutations = arr => {
|
||||
if (arr.length <= 2) return arr.length === 2 ? [arr, [arr[1], arr[0]]] : arr;
|
||||
return arr.reduce(
|
||||
(acc, item, i) =>
|
||||
acc.concat(
|
||||
permutations([...arr.slice(0, i), ...arr.slice(i + 1)]).map(val => [item, ...val])
|
||||
),
|
||||
[]
|
||||
);
|
||||
};
|
||||
module.exports = permutations;
|
||||
@ -1,14 +0,0 @@
|
||||
const test = require('tape');
|
||||
const permutations = require('./permutations.js');
|
||||
|
||||
test('Testing permutations', (t) => {
|
||||
//For more information on all the methods supported by tape
|
||||
//Please go to https://github.com/substack/tape
|
||||
t.true(typeof permutations === 'function', 'permutations is a Function');
|
||||
t.deepEqual(permutations([1, 33, 5]), [ [ 1, 33, 5 ], [ 1, 5, 33 ], [ 33, 1, 5 ], [ 33, 5, 1 ], [ 5, 1, 33 ], [ 5, 33, 1 ] ], 'Generates all permutations of an array');
|
||||
//t.deepEqual(permuteAll(args..), 'Expected');
|
||||
//t.equal(permuteAll(args..), 'Expected');
|
||||
//t.false(permuteAll(args..), 'Expected');
|
||||
//t.throws(permuteAll(args..), 'Expected');
|
||||
t.end();
|
||||
});
|
||||
Reference in New Issue
Block a user