Skip to content

Commit

Permalink
cast prop ids from felt to uint to enable comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
Nerrolol committed Jun 1, 2024
1 parent b23ba4f commit 873cc9b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/proposals_tests.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,13 @@ fn test_successful_proposal_submission() {
let dispatcher = IProposalsDispatcher { contract_address: gov_contract_addr };

start_prank(CheatTarget::One(gov_contract_addr), admin_addr.try_into().unwrap());
let prop_id_1 = dispatcher.submit_proposal(42, 1);
let prop_id_2 = dispatcher.submit_proposal(43, 1);
let prop_id_1: u128 = dispatcher.submit_proposal(42, 1).try_into().unwrap();
let prop_id_2: u128 = dispatcher.submit_proposal(43, 1).try_into().unwrap();

assert!(prop_id_1 < prop_id_2, "Proposals should have unique ids");

let prop_details_1 = dispatcher.get_proposal_details(prop_id_1);
let prop_details_2 = dispatcher.get_proposal_details(prop_id_2);
let prop_details_1 = dispatcher.get_proposal_details(prop_id_1.try_into().unwrap());
let prop_details_2 = dispatcher.get_proposal_details(prop_id_2.try_into().unwrap());

assert!(prop_details_1.payload == 42, "wrong payload first proposal");
assert!(prop_details_2.payload == 43, "wrong payload second proposal");
Expand Down

0 comments on commit 873cc9b

Please sign in to comment.