Skip to content

Commit ed7975a

Browse files
committed
feat| create spec files
1 parent 8209109 commit ed7975a

File tree

2 files changed

+80
-0
lines changed

2 files changed

+80
-0
lines changed

13_factorial/factorial.spec.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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 1.3076744e+12', () => {
14+
expect(factorial(15)).toBe(1.3076744e12);
15+
});
16+
test.skip('25th factorial number is 1.551121e+25', () => {
17+
expect(factorial(25)).toBe(1.551121e25);
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('DOES accept strings', () => {
29+
expect(factorial("0")).toBe(1);
30+
});
31+
test.skip('DOES accept strings', () => {
32+
expect(factorial("1")).toBe(1);
33+
});
34+
test.skip('DOES accept strings', () => {
35+
expect(factorial("2")).toBe(2);
36+
});
37+
test.skip('DOES accept strings', () => {
38+
expect(factorial("8")).toBe(40320);
39+
});
40+
});
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
const factorial = require("./factorial-solution");
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 1.3076744e+12', () => {
14+
expect(factorial(15)).toBe(1.3076744e12);
15+
});
16+
test.skip('25th factorial number is 1.551121e+25', () => {
17+
expect(factorial(25)).toBe(1.551121e25);
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('DOES accept strings', () => {
29+
expect(factorial("0")).toBe(1);
30+
});
31+
test.skip('DOES accept strings', () => {
32+
expect(factorial("1")).toBe(1);
33+
});
34+
test.skip('DOES accept strings', () => {
35+
expect(factorial("2")).toBe(2);
36+
});
37+
test.skip('DOES accept strings', () => {
38+
expect(factorial("8")).toBe(40320);
39+
});
40+
});

0 commit comments

Comments
 (0)