-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsum-app.test.js
44 lines (38 loc) · 1.29 KB
/
sum-app.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
describe("Sum App", function () {
it("SumApp should have numbers property", function () {
const sumApp = new SumApp();
chai.expect(sumApp).to.have.property("numbers");
});
it("SumApp should have addNumber method", function () {
const sumApp = new SumApp();
chai.expect(sumApp).to.have.property("addNumber");
});
it("The addNumber method should add a number to the numbers array", function () {
const sumApp = new SumApp();
sumApp.addNumber(1);
sumApp.addNumber(1);
sumApp.addNumber(1);
chai.expect(sumApp.numbers.length).to.equal(3);
});
it("SumApp should have getSum method", function () {
const sumApp = new SumApp();
chai.expect(sumApp).to.have.property("getSum");
});
it("The getSum method should sum all added numbers", function () {
const sumApp = new SumApp();
sumApp.addNumber(1);
sumApp.addNumber(2);
sumApp.addNumber(3);
chai.expect(sumApp.getSum()).to.equal(6);
});
it("SumApp should have getSum method", function () {
const sumApp = new SumApp();
chai.expect(sumApp).to.have.property("getSum");
});
it("The reset method should remove all added numbers", function () {
const sumApp = new SumApp();
sumApp.addNumber(1);
sumApp.reset();
chai.expect(sumApp.numbers.length).to.equal(0);
});
});