Commit 8315e7ae 8315e7aeca4a2169d5e80d0df4627cf493646a69 by Vincent Peybernes

#8 Improve result test of election

1 parent 6c7d68e7
Pipeline #14 for 8315e7ae passed in 56 seconds
...@@ -158,5 +158,18 @@ describe('RelativePlacement global', () => { ...@@ -158,5 +158,18 @@ describe('RelativePlacement global', () => {
158 assert.ok(candidates.every(name => result.indexOf(name) != -1)); 158 assert.ok(candidates.every(name => result.indexOf(name) != -1));
159 assert.ok(result.every(name => candidates.indexOf(name) != -1)); 159 assert.ok(result.every(name => candidates.indexOf(name) != -1));
160 }); 160 });
161
162 it('should have placements sum in candidates', () => {
163 election.addVote(['A', 'B', 'C']);
164 election.addVote(['B', 'A', 'C']);
165 election.addVote(['A', 'C', 'B']);
166
167 election.getResult();
168 var candidate = election.candidateList['A'];
169
170 assert.equal(candidate.placements.length, 3);
171 assert.equal(candidate.cumulativePlacement.length, 3);
172 assert.equal(candidate.votes.length, 4);
173 });
161 }); 174 });
162 }); 175 });
...\ No newline at end of file ...\ No newline at end of file
......