[wip] unit tests for mock_share module

This commit is contained in:
Jörn-Michael Miehe 2025-07-14 15:48:37 +00:00
parent 1ac4db28ed
commit 22eeada52a

View file

@ -163,3 +163,25 @@ impl Client for MockClient {
Ok(())
}
}
#[test]
fn insert_share_works() {
use std::collections::HashSet;
let client = MockClient::default();
let share_ids: [_; 8] = std::array::from_fn(|_| ShareID::from(true));
for share_id in share_ids.as_ref() {
assert!(client.insert_share(share_id, MockShare::default()).is_ok());
}
assert_eq!(client.shares.borrow().len(), share_ids.len());
let sid_strings: HashSet<_> = share_ids.iter().map(ToString::to_string).collect();
let cli_strings: HashSet<_> = (client.shares.borrow())
.keys()
.map(ToString::to_string)
.collect();
assert_eq!(sid_strings, cli_strings);
}