Test migration to jest by hand
Apparently using regular expressions is way easier.
This commit is contained in:
9
test/mostPerformant/mostPerformant.js
Normal file
9
test/mostPerformant/mostPerformant.js
Normal file
@ -0,0 +1,9 @@
|
||||
const mostPerformant = (fns, iterations = 10000) => {
|
||||
const times = fns.map(fn => {
|
||||
const before = performance.now();
|
||||
for (let i = 0; i < iterations; i++) fn();
|
||||
return performance.now() - before;
|
||||
|
||||
return times.indexOf(Math.min(...times));
|
||||
};
|
||||
module.exports = mostPerformant;
|
||||
10
test/mostPerformant/mostPerformant.test.js
Normal file
10
test/mostPerformant/mostPerformant.test.js
Normal file
@ -0,0 +1,10 @@
|
||||
const expect = require('expect');
|
||||
const mostPerformant = require('./mostPerformant.js');
|
||||
|
||||
|
||||
test('mostPerformant is a Function', () => {
|
||||
expect(mostPerformant).toBeInstanceOf(Function);
|
||||
});
|
||||
t.pass('Tested by @chalarangelo on 16/02/2018');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user