I'm new to blockchain development and can't figure out what I have done wrong. This is my smart contract Election :
pragma solidity ^0.5.0;
contract Election {
struct Candidate {
uint id;
string name;
uint votecount;
}
mapping (uint => Candidate) public candidates;
uint public candidateCount;
constructor() public {
a=5;
addCandidate("Candidate 1");
addCandidate("Candidate 2");
}
function addCandidate (string memory _name) private {
candidateCount++;
candidates[candidateCount]=Candidate(candidateCount,_name,0);
}
}
This is a javascript file to test if there are exactly two candidates:
var elec=artifacts.require("./Election.sol");
contract("Election",function(accounts){
it("initialised with two candidates", function(){
var a;
return Election.deployed().then(function(instance)
{
return instance.candidateCount.call();
}).then(function(count){
assert.equal(count.toNumber(),2);
});
});
});
This is the error I'm getting. Somebody please help.