Skip to content

Commit 961a893

Browse files
committed
test(event cache): double-check cascading happened in the clear linked chunk test
1 parent 2927974 commit 961a893

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

crates/matrix-sdk-sqlite/src/event_cache_store.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1915,6 +1915,27 @@ mod tests {
19151915
let chunks = store.load_all_chunks(room_id).await.unwrap();
19161916
assert!(chunks.is_empty());
19171917

1918+
// Check that cascading worked. Yes, sqlite, I doubt you.
1919+
store
1920+
.acquire()
1921+
.await
1922+
.unwrap()
1923+
.with_transaction(|txn| -> rusqlite::Result<_> {
1924+
let num_gaps = txn
1925+
.prepare("SELECT COUNT(chunk_id) FROM gaps ORDER BY chunk_id")?
1926+
.query_row((), |row| row.get::<_, u64>(0))?;
1927+
assert_eq!(num_gaps, 0);
1928+
1929+
let num_events = txn
1930+
.prepare("SELECT COUNT(event_id) FROM events ORDER BY chunk_id")?
1931+
.query_row((), |row| row.get::<_, u64>(0))?;
1932+
assert_eq!(num_events, 0);
1933+
1934+
Ok(())
1935+
})
1936+
.await
1937+
.unwrap();
1938+
19181939
// It's okay to re-insert a past event.
19191940
store
19201941
.handle_linked_chunk_updates(

0 commit comments

Comments
 (0)