Add a test for update notifications

This commit is contained in:
Savanni D'Gerinel 2024-11-24 09:50:20 -05:00
parent cadb3ab435
commit c79610bd79
1 changed files with 19 additions and 0 deletions

View File

@ -208,4 +208,23 @@ mod test {
assert_eq!(background_image, Some(AssetId::from("asset_1"))); assert_eq!(background_image, Some(AssetId::from("asset_1")));
}); });
} }
#[tokio::test]
async fn it_sends_notices_to_clients_on_tabletop_change() {
let core = test_core();
let client_id = core.register_client();
let mut receiver = core.connect_client(client_id);
assert_matches!(core.set_background_image(AssetId::from("asset_1")), Ok(()));
match receiver.recv().await {
Some(Message::UpdateTabletop(Tabletop {
background_color,
background_image,
})) => {
assert_eq!(background_color, DEFAULT_BACKGROUND_COLOR);
assert_eq!(background_image, Some(AssetId::from("asset_1")));
}
None => panic!("receiver did not get a message"),
}
}
} }