diff --git a/visions/server/src/core.rs b/visions/server/src/core.rs index d5bcaf0..d157a65 100644 --- a/visions/server/src/core.rs +++ b/visions/server/src/core.rs @@ -208,4 +208,23 @@ mod test { 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"), + } + } }