mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-05-18 13:40:55 -04:00
test(sdk): Add a test for SlidingSyncList::ranges.
This commit is contained in:
@@ -841,6 +841,32 @@ mod tests {
|
||||
assert_eq!(new_list.is_cold.load(Ordering::SeqCst), false);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_sliding_sync_list_ranges() {
|
||||
let list = SlidingSyncList::builder()
|
||||
.name("foo")
|
||||
.sync_mode(SlidingSyncMode::Selective)
|
||||
.ranges(vec![(uint!(0), uint!(1)), (uint!(2), uint!(3))])
|
||||
.build()
|
||||
.unwrap();
|
||||
|
||||
{
|
||||
let lock = list.ranges.read().unwrap();
|
||||
let ranges = Observable::get(&lock);
|
||||
|
||||
assert_eq!(ranges, &[(uint!(0), uint!(1)), (uint!(2), uint!(3))]);
|
||||
}
|
||||
|
||||
list.ranges(vec![(uint!(4), uint!(5)), (uint!(6), uint!(7))]);
|
||||
|
||||
{
|
||||
let lock = list.ranges.read().unwrap();
|
||||
let ranges = Observable::get(&lock);
|
||||
|
||||
assert_eq!(ranges, &[(uint!(4), uint!(5)), (uint!(6), uint!(7))]);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_room_list_entry_is_empty_or_invalidated() {
|
||||
let room_id = room_id!("!foo:bar.org");
|
||||
|
||||
Reference in New Issue
Block a user