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