Test migration to jest by hand
Apparently using regular expressions is way easier.
This commit is contained in:
11
test/howManyTimes/howManyTimes.js
Normal file
11
test/howManyTimes/howManyTimes.js
Normal file
@ -0,0 +1,11 @@
|
||||
const howManyTimes = (num, divisor) => {
|
||||
if (divisor === 1 || divisor === -1) return Infinity;
|
||||
if (divisor === 0) return 0;
|
||||
let i = 0;
|
||||
while (Number.isInteger(num / divisor)) {
|
||||
i++;
|
||||
num = num / divisor;
|
||||
}
|
||||
return i;
|
||||
};
|
||||
module.exports = howManyTimes;
|
||||
8
test/howManyTimes/howManyTimes.test.js
Normal file
8
test/howManyTimes/howManyTimes.test.js
Normal file
@ -0,0 +1,8 @@
|
||||
const expect = require('expect');
|
||||
const howManyTimes = require('./howManyTimes.js');
|
||||
|
||||
|
||||
test('howManyTimes is a Function', () => {
|
||||
expect(howManyTimes).toBeInstanceOf(Function);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user