Test migration to jest by hand
Apparently using regular expressions is way easier.
This commit is contained in:
5
test/unionBy/unionBy.js
Normal file
5
test/unionBy/unionBy.js
Normal file
@ -0,0 +1,5 @@
|
||||
const unionBy = (a, b, fn) => {
|
||||
const s = new Set(a.map(v => fn(v)));
|
||||
return Array.from(new Set([...a, ...b.filter(x => !s.has(fn(x)))]));
|
||||
};
|
||||
module.exports = unionBy;
|
||||
10
test/unionBy/unionBy.test.js
Normal file
10
test/unionBy/unionBy.test.js
Normal file
@ -0,0 +1,10 @@
|
||||
const expect = require('expect');
|
||||
const unionBy = require('./unionBy.js');
|
||||
|
||||
|
||||
test('unionBy is a Function', () => {
|
||||
expect(unionBy).toBeInstanceOf(Function);
|
||||
});
|
||||
t.deepEqual(unionBy([2.1], [1.2, 2.3], Math.floor), [2.1, 1.2], 'Produces the appropriate results');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user