-
Notifications
You must be signed in to change notification settings - Fork 0
/
codegrade_mvp.test.js
117 lines (112 loc) · 3.48 KB
/
codegrade_mvp.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
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
import functions from './index';
describe('fooFunction', ()=>{
it('foo returns foo', ()=>{
expect(functions.foo()).toBe('bar');
})
});
describe('multiplyFunction', ()=>{
it('a * b', ()=>{
expect(functions.multiply(5, 7)).toBe(35);
})
});
describe('dogYearsFunction', ()=>{
it('returns humanYears * 7', ()=>{
expect(functions.dogYears(5)).toBe(35);
})
});
describe('hungryDogFunction', ()=>{
it('Dog is 1 year and is 5lbs or less', ()=>{
expect(functions.hungryDog(4, 1)).toBe(0.2);
})
it('Dog is 1 year and 6 - 10lbs', ()=>{
expect(functions.hungryDog(7, 1)).toBe(0.28);
})
it('Dog is 1 year and 11 - 15lbs', ()=>{
expect(functions.hungryDog(14, 1)).toBe(0.42);
})
it('Dog is 1 year and weighs more than 15lbs', ()=>{
expect(functions.hungryDog(16, 1)).toBe(0.32);
})
it('Dog is 2-4 months', ()=>{
expect(functions.hungryDog(20, 0.2)).toBe(2);
})
it('Dog is 4-7 months', ()=>{
expect(functions.hungryDog(16, 0.33)).toBe(1.6);
})
it('Dog is +7 months', ()=>{
expect(functions.hungryDog(4, 0.583)).toBe(0.16);
})
});
describe('gameFunction', ()=>{
it('return win, lose or tie', ()=>{
expect(functions.game('rock', 'scissors')).toBe('you win!');
})
it('return win, lose or tie', ()=>{
expect(functions.game('rock', 'paper')).toBe('you lose!');
})
it('return win, lose or tie', ()=>{
expect(functions.game('rock', 'rock')).toBe(`it's a tie`);
})
it('return win, lose or tie', ()=>{
expect(functions.game('paper', 'rock')).toBe(`you win!`);
})
it('return win, lose or tie', ()=>{
expect(functions.game('paper', 'scissors')).toBe(`you lose!`);
})
it('return win, lose or tie', ()=>{
expect(functions.game('paper', 'paper')).toBe(`it's a tie`);
})
it('return win, lose or tie', ()=>{
expect(functions.game('scissors', 'paper')).toBe(`you win!`);
})
it('return win, lose or tie', ()=>{
expect(functions.game('scissors', 'rock')).toBe(`you lose!`);
})
});
describe('milesFunction', ()=>{
it('return km * 0.621371', ()=>{
expect(functions.miles(10)).toBe(6.21371);
})
});
describe('feetFunction', ()=>{
it('return cm / 30.48', ()=>{
expect(functions.feet(160)).toBe(5.2493438320209975);
})
});
describe('annoyingSongFunction', ()=>{
it('a string that counts down based on the number imputted', ()=>{
expect(functions.annoyingSong(5)).toBe(`${5} bottles of soda on the wall, ${5} bottles of soda, take one down pass it around ${5 - 1} bottles of soda on the wall`);
})
});
describe('gradeFunction', ()=>{
it('expect A', ()=>{
expect(functions.grade(90)).toBe('you got an A');
})
it('expect A', ()=>{
expect(functions.grade(95)).toBe('you got an A');
})
it('expect B', ()=>{
expect(functions.grade(80)).toBe('you got a B');
})
it('expect B', ()=>{
expect(functions.grade(85)).toBe('you got a B');
})
it('expect C', ()=>{
expect(functions.grade(70)).toBe('you got a C');
})
it('expect C', ()=>{
expect(functions.grade(75)).toBe('you got a C');
})
it('expect D', ()=>{
expect(functions.grade(60)).toBe('you got a D');
})
it('expect D', ()=>{
expect(functions.grade(65)).toBe('you got a D');
})
it('expect F', ()=>{
expect(functions.grade(59)).toBe('you got an F');
})
it('expect F', ()=>{
expect(functions.grade(20)).toBe('you got an F');
})
});