Test migration to jest by hand
Apparently using regular expressions is way easier.
This commit is contained in:
6
test/isPrime/isPrime.js
Normal file
6
test/isPrime/isPrime.js
Normal file
@ -0,0 +1,6 @@
|
||||
const isPrime = num => {
|
||||
const boundary = Math.floor(Math.sqrt(num));
|
||||
for (var i = 2; i <= boundary; i++) if (num % i === 0) return false;
|
||||
return num >= 2;
|
||||
};
|
||||
module.exports = isPrime;
|
||||
9
test/isPrime/isPrime.test.js
Normal file
9
test/isPrime/isPrime.test.js
Normal file
@ -0,0 +1,9 @@
|
||||
const expect = require('expect');
|
||||
const isPrime = require('./isPrime.js');
|
||||
|
||||
|
||||
test('isPrime is a Function', () => {
|
||||
expect(isPrime).toBeInstanceOf(Function);
|
||||
});
|
||||
t.equal(isPrime(11), true, "passed number is a prime");
|
||||
|
||||
Reference in New Issue
Block a user