From 53cd452946aa1e5b5a97ab4fd9e38a8e663c9375 Mon Sep 17 00:00:00 2001 From: Aravinth Manivannan Date: Tue, 21 Jan 2025 15:16:10 +0530 Subject: [PATCH] feat: test Identity.User for resend_verification_email --- src/identity/domain/aggregate.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/identity/domain/aggregate.rs b/src/identity/domain/aggregate.rs index 80bc833..d1048af 100644 --- a/src/identity/domain/aggregate.rs +++ b/src/identity/domain/aggregate.rs @@ -412,4 +412,28 @@ mod tests { .when(IdentityCommand::SetAdmin(cmd)) .then_expect_events(vec![expected]); } + + #[test] + fn test_user_aggregate_resend_verification_email() { + use crate::identity::application::services::resend_verification_email::{ + command::*, service::*, *, + }; + + let cmd = ResendVerificationEmailCommand::get_cmd(); + let expected = IdentityEvent::VerificationEmailResent; + + let mut services = MockIdentityServicesInterface::new(); + services + .expect_resend_verification_email() + .times(IS_CALLED_ONLY_ONCE.unwrap()) + .return_const(ResendVerificationEmailService::mock_service( + IS_CALLED_ONLY_ONCE, + cmd.clone(), + )); + + UserTestFramework::with(Arc::new(services)) + .given_no_previous_events() + .when(IdentityCommand::ResendVerificationEmail(cmd)) + .then_expect_events(vec![expected]); + } }