-
Notifications
You must be signed in to change notification settings - Fork 0
/
calculadora.spec.js
58 lines (39 loc) · 1.23 KB
/
calculadora.spec.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
const calculadora = require("./calculadora");
describe('calcular as espessões', ()=>{
it('deve calcular 1+2', ()=>{
let result = calculadora('1+2');
expect(result).toEqual(3);
});
it('deve calcular 10+350', ()=>{
let result = calculadora('10+350');
expect(result).toEqual(360);
});
it('deve calcular 5+40+100', ()=>{
let result = calculadora('5+40+100');
expect(result).toEqual(145);
});
it('deve calcular 10-2', ()=>{
let result = calculadora('10-2');
expect(result).toEqual(8);
});
it('deve calcular -2+10', ()=>{
let result = calculadora('-2+10');
expect(result).toEqual(8);
});
it('deve calcular 10-2+40', ()=>{
let result = calculadora('10-2+40');
expect(result).toEqual(48);
});
it('deve calcular 2*4', ()=>{
let result = calculadora('2*4');
expect(result).toEqual(8);
});
it('deve calcular 10-2+40*2', ()=>{
let result = calculadora('10-2+40*2');
expect(result).toEqual(88);
});
it('deve calcular 10-2+40*2', ()=>{
let result = calculadora('10-(2+40)*2');
expect(result).toEqual(-74);
});
});