forked from jcamilo721/testing
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathapp.test.js
More file actions
121 lines (92 loc) · 2.32 KB
/
app.test.js
File metadata and controls
121 lines (92 loc) · 2.32 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
const myApp = require("./app");
const { sum, multiply } = myApp;
describe("These are the tests for the sum function", () => {
test("Simply sum 2 & 3", () => {
const first = 2;
const second = 3;
const result = sum(first, second);
expect(first).toBeTruthy();
expect(second).not.toBeNull();
expect(first + second).toBe(result);
});
test("Sum 2 strings and/or numbers", () => {
expect(2 + 3).toBe(sum(2, "3"));
expect(2 + 3).toBe(sum("2", 3));
expect(2 + 3).toBe(sum("2", "3"));
});
test("10.3 and 1 should be equal to 11.3", () => {
expect(11.3).toBe(sum(10.3, 1));
});
});
// test('"1" + "2" should be 3', ()=>{
// // given
// let n1 = "1"
// let n2 = "2"
// // when
// let result = myApp.sum(n1,n2)
// // then
// expect(result).toBe(3)
// })
// test('"10.3" + "1" should be 11.3', ()=>{
// // given
// let n1="10.3"
// let n2="1"
// // when
// let result = myApp.sum(n1, n2)
// // then
// expect(result).toBe(11.3)
// })
// test('"0" + "1" should be 1', ()=>{
// // given
// let n1="0"
// let n2="1"
// // when
// let result = myApp.sum(n1, n2)
// // then
// expect(result).toEqual(1)
// })
// test('1 plus 2 should be equal to 3', () => {
// // given
// let n1 = 2;
// let n2 = 1;
// // when
// let result = myApp.sum(n1, n2);
// // then
// expect(result).toBe(n1 + n2);
// });
// test('1 + 2 not equal to 7', () => {
// // given
// let n1 = 2;
// let n2 = 1;
// // when
// let result = myApp.sum(n1, n2);
// // then
// expect(result).not.toBe(7);
// });
// test('2 * 3 is equal to 6', () => {
// // given
// const n1 = 2;
// const n2 = 3;
// // when
// const result = myApp.multiply(n1, n2);
// // then
// expect(result).toBe(6);
// });
// test('5 * 7 is equal to 35', () => {
// // given
// const n1 = 5;
// const n2 = 7;
// // when
// const result = myApp.multiply(n1, n2);
// // then
// expect(result).toBe(35);
// });
// test("'hello' and 'world' concatenates to 'hello world'", () => {
// // given
// let string1 = "hello"
// let string2 = "world"
// // when
// let result = myApp.concatenate(string1, string2)
// // then
// expect(result).toBe("hello world")
// });