Files
30-seconds-of-code/test/howManyTimes.test.js
2018-10-26 21:15:14 +03:00

19 lines
586 B
JavaScript

const expect = require('expect');
const {howManyTimes} = require('./_30s.js');
test('howManyTimes is a Function', () => {
expect(howManyTimes).toBeInstanceOf(Function);
});
test('howManyTimes returns the correct result', () => {
expect(howManyTimes(100, 2)).toBe(2);
});
test('howManyTimes returns the correct result', () => {
expect(howManyTimes(100, 2.5)).toBe(2);
});
test('howManyTimes returns the correct result', () => {
expect(howManyTimes(100, 0)).toBe(0);
});
test('howManyTimes returns the correct result', () => {
expect(howManyTimes(100, -1)).toBe(Infinity);
});