@@ -459,6 +459,7 @@ impl EventCacheStoreIntegrationTests for DynEventCacheStore {
459
459
// A unique chunk.
460
460
assert_matches ! ( rchunks. next( ) , Some ( chunk) => {
461
461
assert_eq!( chunk. identifier( ) , 2 ) ;
462
+ assert_eq!( chunk. lazy_previous( ) , Some ( CId :: new( 1 ) ) ) ;
462
463
463
464
assert_matches!( chunk. content( ) , ChunkContent :: Items ( events) => {
464
465
assert_eq!( events. len( ) , 3 ) ;
@@ -476,19 +477,17 @@ impl EventCacheStoreIntegrationTests for DynEventCacheStore {
476
477
// Load the previous chunk: this is a gap.
477
478
{
478
479
let first_chunk = linked_chunk. chunks ( ) . next ( ) . unwrap ( ) . identifier ( ) ;
479
- let mut previous_chunk =
480
+ let previous_chunk =
480
481
self . load_previous_chunk ( room_id, first_chunk) . await . unwrap ( ) . unwrap ( ) ;
481
482
482
- // Pretend it's the first chunk.
483
- previous_chunk. previous = None ;
484
-
485
483
let _ = lazy_loader:: insert_new_first_chunk ( & mut linked_chunk, previous_chunk) . unwrap ( ) ;
486
484
487
485
let mut rchunks = linked_chunk. rchunks ( ) ;
488
486
489
487
// The last chunk.
490
488
assert_matches ! ( rchunks. next( ) , Some ( chunk) => {
491
489
assert_eq!( chunk. identifier( ) , 2 ) ;
490
+ assert!( chunk. lazy_previous( ) . is_none( ) ) ;
492
491
493
492
// Already asserted, but let's be sure nothing breaks.
494
493
assert_matches!( chunk. content( ) , ChunkContent :: Items ( events) => {
@@ -502,6 +501,7 @@ impl EventCacheStoreIntegrationTests for DynEventCacheStore {
502
501
// The new chunk.
503
502
assert_matches ! ( rchunks. next( ) , Some ( chunk) => {
504
503
assert_eq!( chunk. identifier( ) , 1 ) ;
504
+ assert_eq!( chunk. lazy_previous( ) , Some ( CId :: new( 0 ) ) ) ;
505
505
506
506
assert_matches!( chunk. content( ) , ChunkContent :: Gap ( gap) => {
507
507
assert_eq!( gap. prev_token, "morbier" ) ;
@@ -524,6 +524,7 @@ impl EventCacheStoreIntegrationTests for DynEventCacheStore {
524
524
// The last chunk.
525
525
assert_matches ! ( rchunks. next( ) , Some ( chunk) => {
526
526
assert_eq!( chunk. identifier( ) , 2 ) ;
527
+ assert!( chunk. lazy_previous( ) . is_none( ) ) ;
527
528
528
529
// Already asserted, but let's be sure nothing breaks.
529
530
assert_matches!( chunk. content( ) , ChunkContent :: Items ( events) => {
@@ -537,6 +538,7 @@ impl EventCacheStoreIntegrationTests for DynEventCacheStore {
537
538
// Its previous chunk.
538
539
assert_matches ! ( rchunks. next( ) , Some ( chunk) => {
539
540
assert_eq!( chunk. identifier( ) , 1 ) ;
541
+ assert!( chunk. lazy_previous( ) . is_none( ) ) ;
540
542
541
543
// Already asserted, but let's be sure nothing breaks.
542
544
assert_matches!( chunk. content( ) , ChunkContent :: Gap ( gap) => {
@@ -547,6 +549,7 @@ impl EventCacheStoreIntegrationTests for DynEventCacheStore {
547
549
// The new chunk.
548
550
assert_matches ! ( rchunks. next( ) , Some ( chunk) => {
549
551
assert_eq!( chunk. identifier( ) , 0 ) ;
552
+ assert!( chunk. lazy_previous( ) . is_none( ) ) ;
550
553
551
554
assert_matches!( chunk. content( ) , ChunkContent :: Items ( events) => {
552
555
assert_eq!( events. len( ) , 2 ) ;
@@ -574,6 +577,7 @@ impl EventCacheStoreIntegrationTests for DynEventCacheStore {
574
577
// The first chunk.
575
578
assert_matches ! ( chunks. next( ) , Some ( chunk) => {
576
579
assert_eq!( chunk. identifier( ) , 0 ) ;
580
+ assert!( chunk. lazy_previous( ) . is_none( ) ) ;
577
581
578
582
assert_matches!( chunk. content( ) , ChunkContent :: Items ( events) => {
579
583
assert_eq!( events. len( ) , 2 ) ;
@@ -585,6 +589,7 @@ impl EventCacheStoreIntegrationTests for DynEventCacheStore {
585
589
// The second chunk.
586
590
assert_matches ! ( chunks. next( ) , Some ( chunk) => {
587
591
assert_eq!( chunk. identifier( ) , 1 ) ;
592
+ assert!( chunk. lazy_previous( ) . is_none( ) ) ;
588
593
589
594
assert_matches!( chunk. content( ) , ChunkContent :: Gap ( gap) => {
590
595
assert_eq!( gap. prev_token, "morbier" ) ;
@@ -594,6 +599,7 @@ impl EventCacheStoreIntegrationTests for DynEventCacheStore {
594
599
// The third and last chunk.
595
600
assert_matches ! ( chunks. next( ) , Some ( chunk) => {
596
601
assert_eq!( chunk. identifier( ) , 2 ) ;
602
+ assert!( chunk. lazy_previous( ) . is_none( ) ) ;
597
603
598
604
assert_matches!( chunk. content( ) , ChunkContent :: Items ( events) => {
599
605
assert_eq!( events. len( ) , 3 ) ;
0 commit comments