Set up automated tests for the application Core #266

Merged
savanni merged 6 commits from visions-core-test into main 2024-11-24 14:53:18 +00:00
1 changed files with 19 additions and 0 deletions
Showing only changes of commit c79610bd79 - Show all commits

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"),
}
}
} }