Skip to content

Commit

Permalink
sort vote history prior to comparision
Browse files Browse the repository at this point in the history
  • Loading branch information
dkijania committed Nov 25, 2021
1 parent 1b15f2c commit e38dfbc
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 45 deletions.
84 changes: 42 additions & 42 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions integration-tests/src/backend/features/votes_history.rs
Expand Up @@ -77,12 +77,11 @@ pub fn votes_history_reflects_casted_votes() {
time::wait_for_epoch(1, nodes[0].rest());

let fragment_statuses = nodes[0].rest().fragments_statuses(fragment_ids).unwrap();
println!("{:?}", fragment_statuses);
assert!(fragment_statuses
.iter()
.all(|(_, status)| matches!(status, FragmentStatus::InABlock { .. })));

let account_votes: Vec<AccountVotes> = {
let mut account_votes: Vec<AccountVotes> = {
let mut votes_registry: HashMap<Hash, Vec<i64>> = nodes[0]
.rest()
.vote_plan_statuses()
Expand All @@ -107,12 +106,15 @@ pub fn votes_history_reflects_casted_votes() {
.collect()
};

let votes_history = alice
let mut votes_history = alice
.votes_history()
.unwrap()
.expect("vote history is empty");

votes_history.sort_by(|x, y| x.vote_plan_id.cmp(&y.vote_plan_id));
account_votes.sort_by(|x, y| x.vote_plan_id.cmp(&y.vote_plan_id));
assert_eq!(votes_history, account_votes);

for account_vote in account_votes {
let actual_ids = alice
.vote_plan_history(account_vote.vote_plan_id)
Expand Down

0 comments on commit e38dfbc

Please sign in to comment.