Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tomyrd committed Jun 10, 2024
1 parent 8f304f8 commit 5c0c6b0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
14 changes: 11 additions & 3 deletions tests/integration/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,16 +135,24 @@ async fn test_p2idr_transfer_consumed_by_target() {
//Check that the note is not consumed by the target account
assert!(matches!(
client.get_input_note(note.id()).unwrap().status(),
NoteStatus::Committed
NoteStatus::Committed { .. }
));

consume_notes(&mut client, from_account_id, &[note.clone()]).await;
assert_account_has_single_asset(&client, from_account_id, faucet_account_id, MINT_AMOUNT).await;

// Check that the note is consumed by the target account
let input_note = client.get_input_note(note.id()).unwrap();
assert!(matches!(input_note.status(), NoteStatus::Consumed));
assert_eq!(input_note.consumer_account_id().unwrap(), from_account_id);
assert!(matches!(input_note.status(), NoteStatus::Consumed { .. }));
if let NoteStatus::Consumed {
consumer_account_id: Some(consumer_account_id),
..
} = input_note.status()
{
assert_eq!(consumer_account_id, from_account_id);
} else {
panic!("Note should be consumed");
}

// Do a transfer from first account to second account with Recall. In this situation we'll do
// the happy path where the `to_account_id` consumes the note
Expand Down
9 changes: 7 additions & 2 deletions tests/integration/onchain_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,13 @@ async fn test_onchain_accounts() {

// Check that the client doesn't know who consumed the note
let input_note = client_1.get_input_note(notes[0].id()).unwrap();
assert!(matches!(input_note.status(), NoteStatus::Consumed));
assert!(input_note.consumer_account_id().is_none());
assert!(matches!(
input_note.status(),
NoteStatus::Consumed {
consumer_account_id: None,
block_height: _
}
));

let new_from_account_balance = client_1
.get_account(from_account_id)
Expand Down

0 comments on commit 5c0c6b0

Please sign in to comment.