ran npm run tdd & generated TDD
This commit is contained in:
7
test/primes/primes.js
Normal file
7
test/primes/primes.js
Normal file
@ -0,0 +1,7 @@
|
||||
module.exports = num => {
|
||||
let arr = Array.from({ length: num - 1 }).map((x, i) => i + 2),
|
||||
sqroot = Math.floor(Math.sqrt(num)),
|
||||
numsTillSqroot = Array.from({ length: sqroot - 1 }).map((x, i) => i + 2);
|
||||
numsTillSqroot.forEach(x => (arr = arr.filter(y => y % x !== 0 || y == x)));
|
||||
return arr;
|
||||
};
|
||||
13
test/primes/primes.test.js
Normal file
13
test/primes/primes.test.js
Normal file
@ -0,0 +1,13 @@
|
||||
const test = require('tape');
|
||||
const primes = require('./primes.js');
|
||||
|
||||
test('Testing primes', (t) => {
|
||||
//For more information on all the methods supported by tape
|
||||
//Please go to https://github.com/substack/tape
|
||||
t.true(typeof primes === 'function', 'primes is a Function');
|
||||
//t.deepEqual(primes(args..), 'Expected');
|
||||
//t.equal(primes(args..), 'Expected');
|
||||
//t.false(primes(args..), 'Expected');
|
||||
//t.throws(primes(args..), 'Expected');
|
||||
t.end();
|
||||
});
|
||||
Reference in New Issue
Block a user