Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CI
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Guillaume DEWISME
CI
Commits
4f478b8b
Commit
4f478b8b
authored
Mar 23, 2025
by
Quentin Hamitouche
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix genesis proposal removal in tests
parent
c155276b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
Voting.test.js
test/Voting.test.js
+7
-7
No files found.
test/Voting.test.js
View file @
4f478b8b
...
...
@@ -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
);
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment