feat: test Identity.User for update_email

This commit is contained in:
Aravinth Manivannan 2025-01-21 14:24:27 +05:30
parent 4c9b75b218
commit 6176daa83d
Signed by: realaravinth
GPG key ID: F8F50389936984FF

View file

@ -338,4 +338,29 @@ mod tests {
.when(IdentityCommand::UpdatePassword(cmd))
.then_expect_events(vec![expected]);
}
#[test]
fn test_user_aggregate_update_email() {
use crate::identity::application::services::update_email::{
command::*, events::*, service::*, *,
};
let cmd = UpdateEmailCommand::get_cmd();
let expected = EmailUpdatedEvent::get_event(&cmd);
let expected = IdentityEvent::EmailUpdated(expected);
let mut services = MockIdentityServicesInterface::new();
services
.expect_update_email()
.times(IS_CALLED_ONLY_ONCE.unwrap())
.return_const(UpdateEmailService::mock_service(
IS_CALLED_ONLY_ONCE,
cmd.clone(),
));
UserTestFramework::with(Arc::new(services))
.given_no_previous_events()
.when(IdentityCommand::UpdateEmail(cmd))
.then_expect_events(vec![expected]);
}
}