feat: test Identity.User for update_password

This commit is contained in:
Aravinth Manivannan 2025-01-21 14:15:49 +05:30
parent 98fa1f21fc
commit 9d1be6a6e1
Signed by: realaravinth
GPG key ID: F8F50389936984FF

View file

@ -313,4 +313,29 @@ mod tests {
.when(IdentityCommand::OwnerAddEmployeeToStore(cmd))
.then_expect_events(vec![expected]);
}
#[test]
fn test_user_aggregate_update_password() {
use crate::identity::application::services::update_password::{
command::*, events::*, service::*, *,
};
let cmd = UpdatePasswordCommand::get_cmd();
let expected = PasswordUpdatedEvent::get_event(&cmd);
let expected = IdentityEvent::PasswordUpdated(expected);
let mut services = MockIdentityServicesInterface::new();
services
.expect_update_password()
.times(IS_CALLED_ONLY_ONCE.unwrap())
.return_const(UpdatePasswordService::mock_service(
IS_CALLED_ONLY_ONCE,
cmd.clone(),
));
UserTestFramework::with(Arc::new(services))
.given_no_previous_events()
.when(IdentityCommand::UpdatePassword(cmd))
.then_expect_events(vec![expected]);
}
}