feat: test Identity.User for set_user_admin
This commit is contained in:
parent
f73ff9b36e
commit
1d7cc0f4f8
1 changed files with 25 additions and 0 deletions
|
@ -387,4 +387,29 @@ mod tests {
|
|||
.when(IdentityCommand::MarkUserVerified(cmd))
|
||||
.then_expect_events(vec![expected]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_user_aggregate_set_admin() {
|
||||
use crate::identity::application::services::set_user_admin::{
|
||||
command::*, events::*, service::*, *,
|
||||
};
|
||||
|
||||
let cmd = SetAdminCommand::get_cmd();
|
||||
let expected = UserPromotedToAdminEvent::get_event(&cmd);
|
||||
let expected = IdentityEvent::UserPromotedToAdmin(expected);
|
||||
|
||||
let mut services = MockIdentityServicesInterface::new();
|
||||
services
|
||||
.expect_set_user_admin()
|
||||
.times(IS_CALLED_ONLY_ONCE.unwrap())
|
||||
.return_const(SetUserAdminService::mock_service(
|
||||
IS_CALLED_ONLY_ONCE,
|
||||
cmd.clone(),
|
||||
));
|
||||
|
||||
UserTestFramework::with(Arc::new(services))
|
||||
.given_no_previous_events()
|
||||
.when(IdentityCommand::SetAdmin(cmd))
|
||||
.then_expect_events(vec![expected]);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue