feat: test Identity.User for login

This commit is contained in:
Aravinth Manivannan 2025-01-21 13:51:03 +05:30
parent 6d6e3da781
commit 04daa0a7c3
Signed by: realaravinth
GPG key ID: F8F50389936984FF

View file

@ -219,6 +219,7 @@ mod tests {
application::services::{
delete_user::{command::DeleteUserCommand, service::DeleteUserService},
events::IdentityEvent,
login::{command::LoginCommand, events::LoginEvent, service::LoginService},
owner_manage_store_employee_service::*,
register_user::{
command::RegisterUserCommand, events::UserRegisteredEvent,
@ -273,6 +274,23 @@ mod tests {
.then_expect_events(vec![expected]);
}
#[test]
fn test_user_aggregate_login_user() {
let cmd = LoginCommand::get_cmd();
let expected = IdentityEvent::Loggedin(LoginEvent::get_event(&cmd));
let mut services = MockIdentityServicesInterface::new();
services
.expect_login()
.times(IS_CALLED_ONLY_ONCE.unwrap())
.return_const(LoginService::mock_service(IS_CALLED_ONLY_ONCE, cmd.clone()));
UserTestFramework::with(Arc::new(services))
.given_no_previous_events()
.when(IdentityCommand::Login(cmd))
.then_expect_events(vec![expected]);
}
#[test]
fn test_user_aggregate_owner_added_employee_to_store() {
let cmd = OwnerAddEmployeeToStoreCommand::get_cmd();