File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
packages/powersync_core/test Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -730,6 +730,28 @@ void main() {
730
730
await Future <void >.delayed (const Duration (milliseconds: 500 ));
731
731
expect (syncService.controller.hasListener, isTrue);
732
732
});
733
+
734
+ test ('closes connection after token expires' , () async {
735
+ final status = await waitForConnection (expectNoWarnings: false );
736
+ syncService.addLine ({
737
+ 'checkpoint' : Checkpoint (
738
+ lastOpId: '4' ,
739
+ writeCheckpoint: null ,
740
+ checksums: [checksum (bucket: 'a' , checksum: 10 )],
741
+ )
742
+ });
743
+
744
+ await expectLater (status, emits (isSyncStatus (downloading: true )));
745
+ syncService.addKeepAlive (0 );
746
+
747
+ await pumpEventQueue ();
748
+ expect (syncService.controller.hasListener, isFalse);
749
+ syncService.endCurrentListener ();
750
+
751
+ // Should reconnect after delay.
752
+ await Future <void >.delayed (const Duration (milliseconds: 500 ));
753
+ expect (syncService.controller.hasListener, isTrue);
754
+ });
733
755
});
734
756
}
735
757
You can’t perform that action at this time.
0 commit comments