From fec2c2ff999356a7a82ca9b49d8bd7193e513ab2 Mon Sep 17 00:00:00 2001 From: Ralf Kistner Date: Thu, 7 Nov 2024 16:21:50 +0200 Subject: [PATCH] Add broken test for remove operations. --- .../powersync/test/bucket_storage_test.dart | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/packages/powersync/test/bucket_storage_test.dart b/packages/powersync/test/bucket_storage_test.dart index e6213513..8b3cac41 100644 --- a/packages/powersync/test/bucket_storage_test.dart +++ b/packages/powersync/test/bucket_storage_test.dart @@ -227,6 +227,34 @@ void main() { await expectNoAssets(); }); + test('put | put remove', () async { + await bucketStorage.saveSyncData(SyncDataBatch([ + SyncBucketData(bucket: 'bucket1', data: [putAsset1_1]), + ])); + + await syncLocalChecked(Checkpoint(lastOpId: '1', checksums: [ + BucketChecksum(bucket: 'bucket1', checksum: 1), + ])); + + expect( + await powersync.execute( + "SELECT id, description, make FROM assets WHERE id = 'O1'"), + equals([ + {'id': 'O1', 'description': 'bar', 'make': null} + ])); + + await bucketStorage.saveSyncData(SyncDataBatch([ + SyncBucketData(bucket: 'bucket1', data: [putAsset1_3]), + SyncBucketData(bucket: 'bucket1', data: [removeAsset1_5]) + ])); + + await syncLocalChecked(Checkpoint(lastOpId: '5', checksums: [ + BucketChecksum(bucket: 'bucket1', checksum: 9), + ])); + + await expectNoAssets(); + }); + test('should use subkeys', () async { // subkeys cause this to be treated as a separate entity in the oplog, // but same entity in the local db.