Skip to content

Commit

Permalink
Add test on certificate pending to verify the new value is overwrite …
Browse files Browse the repository at this point in the history
…the old one
  • Loading branch information
sfauvel committed Nov 27, 2024
1 parent a4e979f commit 6bad9ab
Showing 1 changed file with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,29 @@ mod test {
#[tokio::test]
async fn update_certificate_pending() {
let store = get_certificate_pending_store(true).await;
let certificate_pending = store.get().await.unwrap().unwrap();
let old_certificate_pending = CertificatePending::new(
Epoch(2),
SignedEntityType::MithrilStakeDistribution(Epoch(2)),
fake_data::protocol_parameters(),
fake_data::protocol_parameters(),
fake_data::signers(1),
fake_data::signers(2),
);
assert!(store.save(old_certificate_pending).await.is_ok());

assert!(store.save(certificate_pending).await.is_ok());
let new_certificate_pending = CertificatePending::new(
Epoch(4),
SignedEntityType::MithrilStakeDistribution(Epoch(4)),
fake_data::protocol_parameters(),
fake_data::protocol_parameters(),
fake_data::signers(3),
fake_data::signers(1),
);

assert!(store.save(new_certificate_pending.clone()).await.is_ok());

let certificate_pending = store.get().await.unwrap().unwrap();
assert_eq!(new_certificate_pending, certificate_pending);
}

#[tokio::test]
Expand Down

0 comments on commit 6bad9ab

Please sign in to comment.