|
| 1 | +const factorial = require("./factorial"); |
| 2 | + |
| 3 | +describe('factorial', () => { |
| 4 | + test('4th factorial number is 24', () => { |
| 5 | + expect(factorial(4)).toBe(24); |
| 6 | + }); |
| 7 | + test.skip('6th factorial number is 720', () => { |
| 8 | + expect(factorial(6)).toBe(720); |
| 9 | + }); |
| 10 | + test.skip('10th factorial number is 3628800', () => { |
| 11 | + expect(factorial(10)).toBe(3628800); |
| 12 | + }); |
| 13 | + test.skip('15th factorial number is 1307674368000', () => { |
| 14 | + expect(factorial(15)).toBe(1307674368000); |
| 15 | + }); |
| 16 | + test.skip('25th factorial number is 1.5511210043330986e+25', () => { |
| 17 | + expect(factorial(25)).toBe(1.5511210043330986e+25); |
| 18 | + }); |
| 19 | + test.skip('0th factorial number is 1', () => { |
| 20 | + expect(factorial(0)).toBe(1); |
| 21 | + }); |
| 22 | + test.skip("doesn't accept negatives", () => { |
| 23 | + expect(factorial(-25)).toBe(undefined); |
| 24 | + }); |
| 25 | + test.skip("doesn't accept floats", () => { |
| 26 | + expect(factorial(5.4)).toBe(undefined); |
| 27 | + }); |
| 28 | + test.skip("doesn't accept a number as a string", () => { |
| 29 | + expect(factorial('5')).toBe(undefined); |
| 30 | + }); |
| 31 | + test.skip("doesn't accept strings", () => { |
| 32 | + expect(factorial('foo')).toBe(undefined); |
| 33 | + }); |
| 34 | + test.skip("doesn't accept arrays", () => { |
| 35 | + expect(factorial([5])).toBe(undefined); |
| 36 | + }); |
| 37 | +}); |
0 commit comments