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 @@ -701,6 +701,28 @@ void main() {
701701 await Future <void >.delayed (const Duration (milliseconds: 500 ));
702702 expect (syncService.controller.hasListener, isTrue);
703703 });
704+
705+ test ('closes connection after token expires' , () async {
706+ final status = await waitForConnection (expectNoWarnings: false );
707+ syncService.addLine ({
708+ 'checkpoint' : Checkpoint (
709+ lastOpId: '4' ,
710+ writeCheckpoint: null ,
711+ checksums: [checksum (bucket: 'a' , checksum: 10 )],
712+ )
713+ });
714+
715+ await expectLater (status, emits (isSyncStatus (downloading: true )));
716+ syncService.addKeepAlive (0 );
717+
718+ await pumpEventQueue ();
719+ expect (syncService.controller.hasListener, isFalse);
720+ syncService.endCurrentListener ();
721+
722+ // Should reconnect after delay.
723+ await Future <void >.delayed (const Duration (milliseconds: 500 ));
724+ expect (syncService.controller.hasListener, isTrue);
725+ });
704726 });
705727}
706728
You can’t perform that action at this time.
0 commit comments