Skip to content

Commit 1749b3c

Browse files
committed
Test closing connections
1 parent 832f4a1 commit 1749b3c

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

packages/powersync_core/test/in_memory_sync_test.dart

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import 'package:powersync_core/src/sync/streaming_sync.dart';
99
import 'package:powersync_core/src/sync/protocol.dart';
1010
import 'package:test/test.dart';
1111

12+
import 'bucket_storage_test.dart';
1213
import 'server/sync_server/in_memory_sync_server.dart';
1314
import 'utils/abstract_test_utils.dart';
1415
import 'utils/in_memory_http.dart';
@@ -653,6 +654,23 @@ void main() {
653654
emits(isSyncStatus(downloading: false, downloadProgress: isNull)));
654655
});
655656
});
657+
658+
test('stopping closes connections', () async {
659+
final status = await waitForConnection();
660+
661+
syncService.addLine({
662+
'checkpoint': Checkpoint(
663+
lastOpId: '4',
664+
writeCheckpoint: null,
665+
checksums: [checksum(bucket: 'a', checksum: 0)],
666+
)
667+
});
668+
669+
await expectLater(status, emits(isSyncStatus(downloading: true)));
670+
await syncClient.abort();
671+
672+
expect(syncService.controller.hasListener, isFalse);
673+
});
656674
});
657675
}
658676

0 commit comments

Comments
 (0)