Commit 4f478b8b authored by Quentin Hamitouche's avatar Quentin Hamitouche

Fix genesis proposal removal in tests

parent c155276b
......@@ -54,7 +54,7 @@ describe("Contrat Voting", function () {
await voting.startProposalsRegistration(60);
await expect(voting.connect(voter1).registerProposal("Proposition 1"))
.to.emit(voting, "ProposalRegistered")
.withArgs(1); // Index 1 car la proposition genesis est à l'index 0
.withArgs(0);
});
it("ne devrait pas permettre aux non-électeurs de soumettre des propositions", async function () {
......@@ -130,13 +130,13 @@ describe("Contrat Voting", function () {
});
it("devrait automatiquement voter si le délégué a déjà voté", async function () {
await voting.connect(voter2).vote(2); // Voter2 vote pour la proposition 2
await voting.connect(voter2).vote(1); // Voter2 vote pour la proposition 2
await voting.connect(voter1).delegateVoteTo(voter2.address); // Voter1 délègue à voter2
// Vérification que voter1 a effectivement voté pour la même proposition que voter2
const [, hasVoted, votedProposalId] = await voting.connect(voter1).getVoter(voter1.address);
expect(hasVoted).to.be.true;
expect(votedProposalId).to.equal(2);
expect(votedProposalId).to.equal(1);
});
it("ne devrait pas permettre les boucles de délégation", async function () {
......@@ -171,9 +171,9 @@ describe("Contrat Voting", function () {
await voting.startVotingSession(60);
// Voter1 et voter3 votent pour la proposition 1, voter2 pour la proposition 2
await voting.connect(voter1).vote(1);
await voting.connect(voter2).vote(2);
await voting.connect(voter3).vote(1);
await voting.connect(voter1).vote(0);
await voting.connect(voter2).vote(1);
await voting.connect(voter3).vote(0);
await voting.endVotingSession();
});
......@@ -189,7 +189,7 @@ describe("Contrat Voting", function () {
const [winningProposalId, description, voteCount] = await voting.getWinner();
// Vérification que la proposition 1 a gagné avec 2 votes
expect(winningProposalId).to.equal(1);
expect(winningProposalId).to.equal(0);
expect(description).to.equal("Proposition 1");
expect(voteCount).to.equal(2);
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment