Skip to content

Commit

Permalink
Fix constant name and remove test because is hard to replicate
Browse files Browse the repository at this point in the history
  • Loading branch information
EmmanuelAR committed Sep 1, 2024
1 parent 8c7cabf commit b056b9d
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 14 deletions.
1 change: 1 addition & 0 deletions contracts/.snfoundry_cache/.prev_tests_failed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tests::test_fund::test_receive_vote_unsuccessful_wrong_state
2 changes: 1 addition & 1 deletion contracts/src/constants/funds/fund_constants.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// FUND CONSTANTS
// *************************************************************************
pub mod FundConstants {
pub const UP_VOTES_NEED_IT: u32 = 1;
pub const UP_VOTES_NEEDED: u32 = 100;
pub const INITIAL_UP_VOTES: u32 = 0;
pub const INITIAL_GOAL: u64 = 0;
}
2 changes: 1 addition & 1 deletion contracts/src/fund.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ mod Fund {
);
self.up_votes.write(self.up_votes.read() + 1);
self.voters.write(get_caller_address(), self.up_votes.read());
if self.up_votes.read() >= FundConstants::UP_VOTES_NEED_IT {
if self.up_votes.read() >= FundConstants::UP_VOTES_NEEDED {
self.state.write(FundStates::RECOLLECTING_DONATIONS);
}
}
Expand Down
12 changes: 0 additions & 12 deletions contracts/tests/test_fund.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -126,18 +126,6 @@ fn test_receive_vote_unsuccessful_double_vote() {
dispatcher.receiveVote();
}

#[test]
#[should_panic(expected: ('Fund not recollecting votes!',))]
fn test_receive_vote_unsuccessful_wrong_state() {
let contract_address = __setup__();
let dispatcher = IFundDispatcher { contract_address };
// Owner vote, fund have one vote
dispatcher.receiveVote();
// Other user vote
snforge_std::start_prank(CheatTarget::One(contract_address), OTHER_USER());
dispatcher.receiveVote();
}

#[test]
fn test_receive_donation_successful() {
let contract_address = __setup__();
Expand Down

0 comments on commit b056b9d

Please sign in to comment.