|
1 | 1 | const calculator = require('./calculator');
|
2 | 2 |
|
3 | 3 | describe('add', () => {
|
4 |
| - test('adds 0 and 0', () => { |
5 |
| - expect(calculator.add(0, 0)).toBe(0); |
6 |
| - }); |
| 4 | + test('adds 0 and 0', () => { |
| 5 | + expect(calculator.add(0, 0)).toBe(0); |
| 6 | + }); |
7 | 7 |
|
8 |
| - test.skip('adds 2 and 2', () => { |
9 |
| - expect(calculator.add(2, 2)).toBe(4); |
10 |
| - }); |
| 8 | + test.skip('adds 2 and 2', () => { |
| 9 | + expect(calculator.add(2, 2)).toBe(4); |
| 10 | + }); |
11 | 11 |
|
12 |
| - test.skip('adds positive numbers', () => { |
13 |
| - expect(calculator.add(2, 6)).toBe(8); |
14 |
| - }); |
| 12 | + test.skip('adds positive numbers', () => { |
| 13 | + expect(calculator.add(2, 6)).toBe(8); |
| 14 | + }); |
15 | 15 | });
|
16 | 16 |
|
17 | 17 | describe('subtract', () => {
|
18 |
| - test.skip('subtracts numbers', () => { |
19 |
| - expect(calculator.subtract(10, 4)).toBe(6); |
20 |
| - }); |
| 18 | + test.skip('subtracts numbers', () => { |
| 19 | + expect(calculator.subtract(10, 4)).toBe(6); |
| 20 | + }); |
21 | 21 | });
|
22 | 22 |
|
23 | 23 | describe('sum', () => {
|
24 |
| - test.skip('computes the sum of an empty parameter', () => { |
25 |
| - expect(calculator.sum()).toBe(0); |
26 |
| - }); |
| 24 | + test.skip('computes the sum of an empty array', () => { |
| 25 | + expect(calculator.sum([])).toBe(0); |
| 26 | + }); |
27 | 27 |
|
28 |
| - test.skip('computes the sum of one number', () => { |
29 |
| - expect(calculator.sum(7)).toBe(7); |
30 |
| - }); |
| 28 | + test.skip('computes the sum of an array of one number', () => { |
| 29 | + expect(calculator.sum([7])).toBe(7); |
| 30 | + }); |
31 | 31 |
|
32 |
| - test.skip('computes the sum of two numbers', () => { |
33 |
| - expect(calculator.sum(7, 11)).toBe(18); |
34 |
| - }); |
| 32 | + test.skip('computes the sum of an array of two numbers', () => { |
| 33 | + expect(calculator.sum([7, 11])).toBe(18); |
| 34 | + }); |
35 | 35 |
|
36 |
| - test.skip('computes the sum of many numbers', () => { |
37 |
| - expect(calculator.sum(1, 3, 5, 7, 9)).toBe(25); |
38 |
| - }); |
| 36 | + test.skip('computes the sum of an array of many numbers', () => { |
| 37 | + expect(calculator.sum([1, 3, 5, 7, 9])).toBe(25); |
| 38 | + }); |
39 | 39 | });
|
40 | 40 |
|
41 | 41 | describe('multiply', () => {
|
42 |
| - test.skip('multiplies two numbers', () => { |
43 |
| - expect(calculator.multiply(2, 4)).toBe(8); |
44 |
| - }); |
| 42 | + test.skip('multiplies two numbers', () => { |
| 43 | + expect(calculator.multiply([2, 4])).toBe(8); |
| 44 | + }); |
45 | 45 |
|
46 |
| - test.skip('multiplies several numbers', () => { |
47 |
| - expect(calculator.multiply(2, 4, 6, 8, 10, 12, 14)).toBe(645120); |
48 |
| - }); |
| 46 | + test.skip('multiplies several numbers', () => { |
| 47 | + expect(calculator.multiply([2, 4, 6, 8, 10, 12, 14])).toBe(645120); |
| 48 | + }); |
49 | 49 | });
|
50 | 50 |
|
51 | 51 | describe('power', () => {
|
52 |
| - test.skip('raises one number to the power of another number', () => { |
53 |
| - expect(calculator.power(4, 3)).toBe(64); // 4 to third power is 64 |
54 |
| - }); |
| 52 | + test.skip('raises one number to the power of another number', () => { |
| 53 | + expect(calculator.power(4, 3)).toBe(64); // 4 to third power is 64 |
| 54 | + }); |
55 | 55 | });
|
56 | 56 |
|
57 | 57 | describe('factorial', () => {
|
58 |
| - test.skip('computes the factorial of 0', () => { |
59 |
| - expect(calculator.factorial(0)).toBe(1); // 0! = 1 |
60 |
| - }); |
| 58 | + test.skip('computes the factorial of 0', () => { |
| 59 | + expect(calculator.factorial(0)).toBe(1); // 0! = 1 |
| 60 | + }); |
61 | 61 |
|
62 |
| - test.skip('computes the factorial of 1', () => { |
63 |
| - expect(calculator.factorial(1)).toBe(1); |
64 |
| - }); |
| 62 | + test.skip('computes the factorial of 1', () => { |
| 63 | + expect(calculator.factorial(1)).toBe(1); |
| 64 | + }); |
65 | 65 |
|
66 |
| - test.skip('computes the factorial of 2', () => { |
67 |
| - expect(calculator.factorial(2)).toBe(2); |
68 |
| - }); |
| 66 | + test.skip('computes the factorial of 2', () => { |
| 67 | + expect(calculator.factorial(2)).toBe(2); |
| 68 | + }); |
69 | 69 |
|
70 |
| - test.skip('computes the factorial of 5', () => { |
71 |
| - expect(calculator.factorial(5)).toBe(120); |
72 |
| - }); |
| 70 | + test.skip('computes the factorial of 5', () => { |
| 71 | + expect(calculator.factorial(5)).toBe(120); |
| 72 | + }); |
73 | 73 |
|
74 |
| - test.skip('computes the factorial of 10', () => { |
75 |
| - expect(calculator.factorial(10)).toBe(3628800); |
76 |
| - }); |
| 74 | + test.skip('computes the factorial of 10', () => { |
| 75 | + expect(calculator.factorial(10)).toBe(3628800); |
| 76 | + }); |
77 | 77 | });
|
0 commit comments