Add a test for update notifications
This commit is contained in:
parent
cadb3ab435
commit
c79610bd79
|
@ -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"),
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue