[wip] unit tests for mock_share module
This commit is contained in:
parent
1ac4db28ed
commit
22eeada52a
1 changed files with 22 additions and 0 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue