-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtmp_tests.txt
More file actions
91 lines (89 loc) · 1.93 KB
/
tmp_tests.txt
File metadata and controls
91 lines (89 loc) · 1.93 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
test('make a consent list with !all', () => {
var gameState = {
population: {
p1: {
name: 'p1',
gender: 'female',
},
p2: {
name: 'p2',
gender: 'male',
},
p3: {
name: 'p3',
gender: 'male',
},
p4: {
name: 'p4',
gender: 'female',
},
},
round: 'reproduction',
};
expectedList = ['p2', 'p3', '!all'];
inputList = ['p2,', 'p3,', '!all,'];
response = reproLib.handleReproductionList(
'p1',
inputList,
'consentList',
gameState,
{}
);
exp = 'Setting your consentList list to:p2,p3,!all\n';
expect(response).toBe(exp);
expect(gameState['population']['p1']['consentList']).toStrictEqual(
expectedList
);
});
test('make a consent list with !all and a declineList', () => {
var gameState = {
population: {
p1: {
name: 'p1',
gender: 'female',
declineList: ['p3'],
},
p2: {
name: 'p2',
gender: 'male',
},
p3: {
name: 'p3',
gender: 'male',
},
p4: {
name: 'p4',
gender: 'female',
},
},
round: 'reproduction',
};
expectedList = ['p2', 'p3', '!all'];
rawInputList = 'p2, p3, !all';
reproLib.consentPrep(gameState, 'p1', rawInputList);
response = gameState.messages['p1'];
exp = 'Updated consentlist to p2,p3,!all';
expect(response).toContain(exp);
expect(response).toContain('will not override');
expect(response).toContain('Updated');
expect(gameState['population']['p1']['consentList']).toStrictEqual(
expectedList
);
});
test('make a consent list with !none', () => {
var gameState = {
population: {
p1: {
name: 'p1',
gender: 'female',
consentList: ['p2'],
},
p2: {
name: 'p2',
gender: 'male',
consentList: ['!all'],
},
p3: {
name: 'p3',
gender: 'male',
},