File tree 1 file changed +33
-0
lines changed
crates/matrix-sdk-indexeddb/src/event_cache_store
1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -1460,4 +1460,37 @@ mod tests {
1460
1460
} ) ;
1461
1461
}
1462
1462
}
1463
+
1464
+ #[ async_test]
1465
+ async fn test_linked_chunk_new_gap_chunk ( ) {
1466
+ let store = get_event_cache_store ( ) . await . expect ( "creating cache store failed" ) ;
1467
+
1468
+ let room_id = & DEFAULT_TEST_ROOM_ID ;
1469
+
1470
+ store
1471
+ . handle_linked_chunk_updates (
1472
+ room_id,
1473
+ vec ! [ Update :: NewGapChunk {
1474
+ previous: None ,
1475
+ new: ChunkIdentifier :: new( 42 ) ,
1476
+ next: None ,
1477
+ gap: Gap { prev_token: "raclette" . to_owned( ) } ,
1478
+ } ] ,
1479
+ )
1480
+ . await
1481
+ . unwrap ( ) ;
1482
+
1483
+ let mut chunks = store. reload_linked_chunk ( room_id) . await . unwrap ( ) ;
1484
+
1485
+ assert_eq ! ( chunks. len( ) , 1 ) ;
1486
+
1487
+ // Chunks are ordered from smaller to bigger IDs.
1488
+ let c = chunks. remove ( 0 ) ;
1489
+ assert_eq ! ( c. identifier, ChunkIdentifier :: new( 42 ) ) ;
1490
+ assert_eq ! ( c. previous, None ) ;
1491
+ assert_eq ! ( c. next, None ) ;
1492
+ assert_matches ! ( c. content, ChunkContent :: Gap ( gap) => {
1493
+ assert_eq!( gap. prev_token, "raclette" ) ;
1494
+ } ) ;
1495
+ }
1463
1496
}
You can’t perform that action at this time.
0 commit comments