Test migration to jest by hand
Apparently using regular expressions is way easier.
This commit is contained in:
5
test/times/times.js
Normal file
5
test/times/times.js
Normal file
@ -0,0 +1,5 @@
|
||||
const times = (n, fn, context = undefined) => {
|
||||
let i = 0;
|
||||
while (fn.call(context, i) !== false && ++i < n) {}
|
||||
};
|
||||
module.exports = times;
|
||||
14
test/times/times.test.js
Normal file
14
test/times/times.test.js
Normal file
@ -0,0 +1,14 @@
|
||||
const expect = require('expect');
|
||||
const times = require('./times.js');
|
||||
|
||||
|
||||
test('times is a Function', () => {
|
||||
expect(times).toBeInstanceOf(Function);
|
||||
});
|
||||
var output = '';
|
||||
times(5, i => (output += i));
|
||||
test('Runs a function the specified amount of times', () => {
|
||||
expect(output, '01234').toBe()
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user