-
Notifications
You must be signed in to change notification settings - Fork 613
/
index.test.js
172 lines (139 loc) · 6.42 KB
/
index.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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
var { expect } = require('chai')
const getTimeForEducation = require('./src/index')
const defaultStudentSpeedConfig = {
family: 4,
friends: 10,
normal_life: 20,
profession: 30,
carrier: 40,
top_peformance: 60
}
const problemStudentSpeedConfig = {
family: 2,
friends: 4,
normal_life: 8,
profession: 20,
carrier: 30
}
const talentedStudentSpeedConfig = {
normal_life: 30,
profession: 40,
carrier: 55,
top_peformance: 70
}
describe('js-edu', () => {
describe('for general student with programming skills', () => {
it('should could take 200 weeks for family focus', () => {
const weeks = getTimeForEducation('family', true, defaultStudentSpeedConfig);
expect(weeks).to.equal(200);
});
it('should could take 80 weeks for friends focus', () => {
const weeks = getTimeForEducation('friends', true, defaultStudentSpeedConfig);
expect(weeks).to.equal(80);
});
it('should could take 40 weeks for normal_life focus', () => {
const weeks = getTimeForEducation('normal_life', true, defaultStudentSpeedConfig);
expect(weeks).to.equal(40);
});
it('should could take 27 weeks for profession focus', () => {
const weeks = getTimeForEducation('profession', true, defaultStudentSpeedConfig);
expect(weeks).to.equal(27);
});
it('should could take 20 weeks for carrier focus', () => {
const weeks = getTimeForEducation('carrier', true, defaultStudentSpeedConfig);
expect(weeks).to.equal(20);
});
it('should could take 14 weeks for top_peformance focus', () => {
const weeks = getTimeForEducation('top_peformance', true, defaultStudentSpeedConfig);
expect(weeks).to.equal(14);
});
});
describe('for problem student with programming skills', () => {
const studentConfig = problemStudentSpeedConfig;
it('should could take a lot of weeks for family focus', () => {
const weeks = getTimeForEducation('family', true, studentConfig);
expect(weeks).to.equal(400);
});
it('should could take less weeks for friends focus', () => {
const weeks = getTimeForEducation('friends', true, studentConfig);
expect(weeks).to.equal(200);
});
it('should could take normal number of weeks for normal_life focus', () => {
const weeks = getTimeForEducation('normal_life', true, studentConfig);
expect(weeks).to.equal(100);
});
it('should could take optimal number of weeks for profession focus', () => {
const weeks = getTimeForEducation('profession', true, studentConfig);
expect(weeks).to.equal(40);
});
it('should could take a few weeks for carrier focus', () => {
const weeks = getTimeForEducation('carrier', true, studentConfig);
expect(weeks).to.equal(27);
});
});
describe('for talented student with programming skills', () => {
const studentConfig = talentedStudentSpeedConfig;
it('should could take normal number of weeks for normal_life focus', () => {
const weeks = getTimeForEducation('normal_life', true, studentConfig);
expect(weeks).to.equal(27);
});
it('should could take optimal number of weeks for profession focus', () => {
const weeks = getTimeForEducation('profession', true, studentConfig);
expect(weeks).to.equal(20);
});
it('should could take a few weeks for carrier focus', () => {
const weeks = getTimeForEducation('carrier', true, studentConfig);
expect(weeks).to.equal(15);
});
it('should could take 14 weeks for top_peformance focus', () => {
const weeks = getTimeForEducation('top_peformance', true, studentConfig);
expect(weeks).to.equal(12);
});
});
describe('for general student without programming skills', () => {
const studentConfig = defaultStudentSpeedConfig;
it('should could take a lot of weeks for family focus', () => {
const weeks = getTimeForEducation('family', false, studentConfig);
expect(weeks).to.equal(325);
});
it('should could take less weeks for friends focus', () => {
const weeks = getTimeForEducation('friends', false, studentConfig);
expect(weeks).to.equal(130);
});
it('should could take normal number of weeks for normal_life focus', () => {
const weeks = getTimeForEducation('normal_life', false, studentConfig);
expect(weeks).to.equal(65);
});
it('should could take optimal number of weeks for profession focus', () => {
const weeks = getTimeForEducation('profession', false, studentConfig);
expect(weeks).to.equal(44);
});
it('should could take a few weeks for carrier focus', () => {
const weeks = getTimeForEducation('carrier', false, studentConfig);
expect(weeks).to.equal(33);
});
});
describe('for problem student without programming skills', () => {
const studentConfig = problemStudentSpeedConfig;
it('should could take a lot of weeks for family focus', () => {
const weeks = getTimeForEducation('family', false, studentConfig);
expect(weeks).to.equal(650);
});
it('should could take less weeks for friends focus', () => {
const weeks = getTimeForEducation('friends', false, studentConfig);
expect(weeks).to.equal(325);
});
it('should could take normal number of weeks for normal_life focus', () => {
const weeks = getTimeForEducation('normal_life', false, studentConfig);
expect(weeks).to.equal(163);
});
it('should could take optimal number of weeks for profession focus', () => {
const weeks = getTimeForEducation('profession', false, studentConfig);
expect(weeks).to.equal(65);
});
it('should could take a few weeks for carrier focus', () => {
const weeks = getTimeForEducation('carrier', false, studentConfig);
expect(weeks).to.equal(44);
});
});
});