it("throws an exception for invalid candidates", function() {
return Election.deployed().then(function(instance) {
electionInstance = instance;
return electionInstance.vote(99, { from: accounts[1] })
}).then(assert.fail).catch(function(error) {
assert(error.message.indexOf('revert') >= 0, "error message must contain revert");
return electionInstance.candidates(1);
}).then(function(candidate1) {
var voteCount = candidate1[2];
assert.equal(voteCount, 1, "Eric did not receive any votes");
return electionInstance.candidates(2);
}).then(function(candidate2) {
var voteCount = candidate2[2];
assert.equal(voteCount, 0, "Helen did not receive any votes");
return electionInstance.candidates(3);
}).then(function(candidate3) {
var voteCount = candidate3[2];
assert.equal(voteCount, 0, "Elena did not receive any votes");
});
});
问题:以上这段代码中,Eric 对应的 voteCount 是 1,为什么 也是 "Eric did not receive any votes",是否应为,Eric has received one vote.
问题:以上这段代码中,Eric 对应的 voteCount 是 1,为什么 也是 "Eric did not receive any votes",是否应为,Eric has received one vote.