Skip to content

Commit 52f0475

Browse files
committed
test(common): support renames also check handle changes, and the CLI is a fixture like the other actors
1 parent 22cb687 commit 52f0475

1 file changed

Lines changed: 19 additions & 8 deletions

File tree

‎crates/common/src/notifications/tests.rs‎

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,26 @@ fn admin() -> Actor {
2121
}
2222
}
2323

24-
/// Support renaming an account or one of its passkeys, or removing its picture,
25-
/// tells its owner; the owner doing so does not.
26-
#[test]
27-
fn only_support_renames_notify() {
28-
let cli = Actor::Cli {
24+
/// An operator, through the CLI.
25+
fn cli() -> Actor {
26+
Actor::Cli {
2927
os_user: "root".to_owned(),
3028
host: "host".to_owned(),
31-
};
29+
}
30+
}
31+
32+
/// Support changing an account's handle or display name, renaming one of its
33+
/// passkeys, or removing its picture, tells its owner; the owner doing so does not.
34+
#[test]
35+
fn only_support_renames_notify() {
3236
for (event, notification) in [
37+
(
38+
DomainEvent::HandleChanged {
39+
old: Personal::Value("ada".to_owned()),
40+
new: Personal::Value("ada-l".parse().expect("handle")),
41+
},
42+
Notification::HandleChanged,
43+
),
3344
(
3445
DomainEvent::DisplayNameChanged {
3546
old: Personal::Value("Ada".to_owned()),
@@ -46,8 +57,8 @@ fn only_support_renames_notify() {
4657
(DomainEvent::PictureRemoved {}, Notification::PictureRemoved),
4758
] {
4859
assert_eq!(event.notification(&owner()), None, "{event:?}");
49-
for support in [admin(), cli.clone()] {
50-
let expected = Some(notification.clone());
60+
let expected = Some(notification);
61+
for support in [admin(), cli()] {
5162
assert_eq!(event.notification(&support), expected, "{event:?}");
5263
}
5364
}

0 commit comments

Comments
 (0)