feat: test Identity.User for owner_remove_employee_from_store

This commit is contained in:
Aravinth Manivannan 2025-01-21 15:21:40 +05:30
parent 5b852cc956
commit 382c0cf370
Signed by: realaravinth
GPG key ID: F8F50389936984FF

View file

@ -227,7 +227,11 @@ mod tests {
},
IdentityCommand, MockIdentityServicesInterface,
},
domain::{owner_add_employee_to_store_command::*, owner_added_employee_to_store_event::*},
domain::{
owner_add_employee_to_store_command::*, owner_added_employee_to_store_event::*,
owner_remove_employee_from_store_command::OwnerRemoveEmployeeFromStoreCommand,
owner_removed_employee_from_store_event::OwnerRemovedEmployeeFromStoreEvent,
},
};
use crate::tests::bdd::*;
@ -314,6 +318,29 @@ mod tests {
.then_expect_events(vec![expected]);
}
#[test]
fn test_user_aggregate_owner_remove_employee_to_store() {
let cmd = OwnerRemoveEmployeeFromStoreCommand::get_cmd();
let expected = OwnerRemovedEmployeeFromStoreEvent::get_event(&cmd);
let expected = IdentityEvent::OwnerRemovedEmployeeFromStore(expected);
let mut services = MockIdentityServicesInterface::new();
services
.expect_owner_manage_employee()
.times(IS_CALLED_ONLY_ONCE.unwrap())
.return_const(
OwnerManageStoreEmployeesService::mock_service_remove_employee_from_store(
IS_CALLED_ONLY_ONCE,
cmd.clone(),
),
);
UserTestFramework::with(Arc::new(services))
.given_no_previous_events()
.when(IdentityCommand::OwnerRemoveEmployeeFromStore(cmd))
.then_expect_events(vec![expected]);
}
#[test]
fn test_user_aggregate_update_password() {
use crate::identity::application::services::update_password::{