#8 Improve result test of election
Showing
1 changed file
with
13 additions
and
0 deletions
... | @@ -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 | ... | ... |
-
Please register or sign in to post a comment