File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
packages/powersync_core/test Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -280,6 +280,37 @@ void main() {
280280 .hasSynced,
281281 isFalse);
282282 });
283+
284+ test (
285+ "multiple completed syncs don't create multiple sync state entries" ,
286+ () async {
287+ final status = await waitForConnection ();
288+
289+ for (var i = 0 ; i < 5 ; i++ ) {
290+ syncService.addLine ({
291+ 'checkpoint' : Checkpoint (
292+ lastOpId: '0' ,
293+ writeCheckpoint: null ,
294+ checksums: [
295+ BucketChecksum (bucket: 'bkt' , priority: 1 , checksum: 0 )
296+ ],
297+ )
298+ });
299+ await expectLater (status, emits (isSyncStatus (downloading: true )));
300+
301+ syncService.addLine ({
302+ 'checkpoint_complete' : {
303+ 'last_op_id' : '0' ,
304+ }
305+ });
306+
307+ await expectLater (status, emits (isSyncStatus (downloading: false )));
308+ }
309+
310+ final rows = await database.getAll ('SELECT * FROM ps_sync_state;' );
311+ expect (rows, hasLength (1 ));
312+ },
313+ );
283314 });
284315 });
285316}
You can’t perform that action at this time.
0 commit comments