mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-05-06 23:15:08 -04:00
test(sdk): Test SlidingSyncListBuilder::once_built.
This commit is contained in:
@@ -2142,4 +2142,24 @@ mod tests {
|
||||
room_list = [F("!r0:x.y"), F("!r1:x.y"), F("!r2:x.y")],
|
||||
};
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_once_built() {
|
||||
let (sender, _receiver) = channel(1);
|
||||
|
||||
let probe = std::sync::Arc::new(std::sync::Mutex::new(std::cell::Cell::new(false)));
|
||||
let probe_clone = probe.clone();
|
||||
|
||||
let _list = SlidingSyncList::builder("testing")
|
||||
.once_built(move |list| {
|
||||
let mut probe_lock = probe.lock().unwrap();
|
||||
*probe_lock.get_mut() = true;
|
||||
|
||||
list
|
||||
})
|
||||
.build(sender);
|
||||
|
||||
let probe_lock = probe_clone.lock().unwrap();
|
||||
assert_eq!(probe_lock.get(), true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user