ran npm run tdd & generated TDD
This commit is contained in:
8
test/sampleSize/sampleSize.js
Normal file
8
test/sampleSize/sampleSize.js
Normal file
@ -0,0 +1,8 @@
|
||||
module.exports = ([...arr], n = 1) => {
|
||||
let m = arr.length;
|
||||
while (m) {
|
||||
const i = Math.floor(Math.random() * m--);
|
||||
[arr[m], arr[i]] = [arr[i], arr[m]];
|
||||
}
|
||||
return arr.slice(0, n);
|
||||
};
|
||||
13
test/sampleSize/sampleSize.test.js
Normal file
13
test/sampleSize/sampleSize.test.js
Normal file
@ -0,0 +1,13 @@
|
||||
const test = require('tape');
|
||||
const sampleSize = require('./sampleSize.js');
|
||||
|
||||
test('Testing sampleSize', (t) => {
|
||||
//For more information on all the methods supported by tape
|
||||
//Please go to https://github.com/substack/tape
|
||||
t.true(typeof sampleSize === 'function', 'sampleSize is a Function');
|
||||
//t.deepEqual(sampleSize(args..), 'Expected');
|
||||
//t.equal(sampleSize(args..), 'Expected');
|
||||
//t.false(sampleSize(args..), 'Expected');
|
||||
//t.throws(sampleSize(args..), 'Expected');
|
||||
t.end();
|
||||
});
|
||||
Reference in New Issue
Block a user