Skip to content

Commit

Permalink
Add broken test for remove operations.
Browse files Browse the repository at this point in the history
  • Loading branch information
rkistner committed Nov 7, 2024
1 parent 5380941 commit fec2c2f
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions packages/powersync/test/bucket_storage_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit fec2c2f

Please sign in to comment.