Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: assert last event #25

Merged
merged 5 commits into from
Nov 5, 2024
Merged

Conversation

chungquantin
Copy link
Collaborator

@chungquantin chungquantin commented Nov 4, 2024

Asserts that the latest event matches an expected event.

This can be used to assert that an event emitted from the latest contract execution resulted in a specific event.

Example

assert_last_event!(
	&session,
 	Transfer {
 		from: Some(account_id_from_slice(&contract)),
 		to: Some(account_id_from_slice(&BOB)),
 		value,
 	}
);

Parameters:

  • session - The session for interacting with contracts.
  • event - The expected event.
#[macro_export]
macro_rules! assert_last_event {
	($session:expr, $event:expr $(,)?) => {
		$crate::macros::assert_last_event_inner::<_, _>($session, $event);
	};
}

@chungquantin chungquantin linked an issue Nov 4, 2024 that may be closed by this pull request
@chungquantin chungquantin merged commit e131e72 into main Nov 5, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: assert_last_event macro
1 participant