feat(voting): token-weighted voting module — expand test coverage to 25 cases#496
Merged
truthixify merged 2 commits intoDistinctCodes:mainfrom Feb 22, 2026
Conversation
…ted voting module Covers all acceptance criteria from issue DistinctCodes#471: - cast_vote: AlreadyVoted error, InsufficientVotingPower error, holder not found, asset not tokenized, vote weight equals token balance, exact threshold boundary, same voter on different proposals, multiple voters on same proposal - get_vote_tally: starts at zero, error on non-tokenized asset, accumulates multiple voters, isolated per proposal ID - has_voted: returns false before voting, true after voting, error on non-tokenized asset, independent per proposal - proposal_passed: no votes case, non-tokenized asset error, respects min_voting_threshold, multiple voters crossing the threshold
|
@KevinMB0220 is attempting to deploy a commit to the naijabuz's projects Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #471
Implements comprehensive test coverage for the token-weighted voting module (
cast_vote,get_vote_tally,has_voted,proposal_passed), expanding from 6 to 25 test cases that verify all acceptance criteria from the issue.cast_vote: double-vote returnsAlreadyVoted, insufficient balance returnsInsufficientVotingPower, non-holder returnsHolderNotFound, non-tokenized asset returnsAssetNotTokenized, vote weight equals token balance at time of voting, exact threshold boundary, same voter on independent proposals, multiple voters on same proposalget_vote_tally: starts at zero, error on non-tokenized asset, accumulates weighted votes across multiple voters, tally is isolated per proposal IDhas_voted: returnsfalsebefore voting,trueafter voting, error on non-tokenized asset, independent per proposalproposal_passed: returnsfalsewith no votes, error on non-tokenized asset, respectsmin_voting_threshold, correctly transitions from failing to passing as more voters cross the thresholdTest plan
cargo fmt— no formatting issuescargo clippy— 0 warningscargo build— compiles successfullycargo test— 92/92 tests pass