@powersync/service-core-tests 0.13.2 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/dist/test-utils/general-utils.d.ts +9 -3
  3. package/dist/test-utils/general-utils.js +26 -26
  4. package/dist/test-utils/general-utils.js.map +1 -1
  5. package/dist/tests/register-compacting-tests.d.ts +1 -1
  6. package/dist/tests/register-compacting-tests.js +136 -93
  7. package/dist/tests/register-compacting-tests.js.map +1 -1
  8. package/dist/tests/register-data-storage-checkpoint-tests.d.ts +1 -1
  9. package/dist/tests/register-data-storage-checkpoint-tests.js +44 -27
  10. package/dist/tests/register-data-storage-checkpoint-tests.js.map +1 -1
  11. package/dist/tests/register-data-storage-data-tests.d.ts +2 -2
  12. package/dist/tests/register-data-storage-data-tests.js +715 -207
  13. package/dist/tests/register-data-storage-data-tests.js.map +1 -1
  14. package/dist/tests/register-data-storage-parameter-tests.d.ts +1 -1
  15. package/dist/tests/register-data-storage-parameter-tests.js +123 -58
  16. package/dist/tests/register-data-storage-parameter-tests.js.map +1 -1
  17. package/dist/tests/register-parameter-compacting-tests.d.ts +1 -1
  18. package/dist/tests/register-parameter-compacting-tests.js +13 -13
  19. package/dist/tests/register-parameter-compacting-tests.js.map +1 -1
  20. package/dist/tests/register-sync-tests.d.ts +4 -1
  21. package/dist/tests/register-sync-tests.js +63 -34
  22. package/dist/tests/register-sync-tests.js.map +1 -1
  23. package/dist/tests/util.d.ts +6 -1
  24. package/dist/tests/util.js +31 -2
  25. package/dist/tests/util.js.map +1 -1
  26. package/package.json +3 -3
  27. package/src/test-utils/general-utils.ts +42 -28
  28. package/src/tests/register-compacting-tests.ts +153 -103
  29. package/src/tests/register-data-storage-checkpoint-tests.ts +70 -22
  30. package/src/tests/register-data-storage-data-tests.ts +732 -110
  31. package/src/tests/register-data-storage-parameter-tests.ts +168 -59
  32. package/src/tests/register-parameter-compacting-tests.ts +18 -13
  33. package/src/tests/register-sync-tests.ts +71 -35
  34. package/src/tests/util.ts +52 -2
  35. package/tsconfig.tsbuildinfo +1 -1
@@ -1,9 +1,9 @@
1
- import { JwtPayload, storage } from '@powersync/service-core';
1
+ import { CURRENT_STORAGE_VERSION, JwtPayload, storage, updateSyncRulesFromYaml } from '@powersync/service-core';
2
2
  import { RequestParameters, ScopedParameterLookup, SqliteJsonRow } from '@powersync/service-sync-rules';
3
3
  import { expect, test } from 'vitest';
4
4
  import * as test_utils from '../test-utils/test-utils-index.js';
5
- import { TEST_TABLE } from './util.js';
6
- import { ParameterLookupScope } from '@powersync/service-sync-rules/src/HydrationState.js';
5
+ import { bucketRequest } from '../test-utils/test-utils-index.js';
6
+ import { parameterLookupScope } from './util.js';
7
7
 
8
8
  /**
9
9
  * @example
@@ -15,23 +15,33 @@ import { ParameterLookupScope } from '@powersync/service-sync-rules/src/Hydratio
15
15
  *
16
16
  * ```
17
17
  */
18
- export function registerDataStorageParameterTests(generateStorageFactory: storage.TestStorageFactory) {
19
- const MYBUCKET_1: ParameterLookupScope = { lookupName: 'mybucket', queryId: '1' };
18
+ export function registerDataStorageParameterTests(config: storage.TestStorageConfig) {
19
+ const generateStorageFactory = config.factory;
20
+ const storageVersion = config.storageVersion ?? CURRENT_STORAGE_VERSION;
21
+ const TEST_TABLE = test_utils.makeTestTable('test', ['id'], config);
22
+ const MYBUCKET_1 = parameterLookupScope('mybucket', '1');
20
23
 
21
24
  test('save and load parameters', async () => {
22
25
  await using factory = await generateStorageFactory();
23
- const syncRules = await factory.updateSyncRules({
24
- content: `
26
+ const syncRules = await factory.updateSyncRules(
27
+ updateSyncRulesFromYaml(
28
+ `
25
29
  bucket_definitions:
26
30
  mybucket:
27
31
  parameters:
28
32
  - SELECT group_id FROM test WHERE id1 = token_parameters.user_id OR id2 = token_parameters.user_id
29
33
  data: []
30
- `
31
- });
34
+ `,
35
+ {
36
+ storageVersion
37
+ }
38
+ )
39
+ );
32
40
  const bucketStorage = factory.getInstance(syncRules);
33
41
 
34
42
  await bucketStorage.startBatch(test_utils.BATCH_OPTIONS, async (batch) => {
43
+ await batch.markAllSnapshotDone('1/1');
44
+
35
45
  await batch.save({
36
46
  sourceTable: TEST_TABLE,
37
47
  tag: storage.SaveOperationTag.INSERT,
@@ -70,18 +80,24 @@ bucket_definitions:
70
80
 
71
81
  test('it should use the latest version', async () => {
72
82
  await using factory = await generateStorageFactory();
73
- const syncRules = await factory.updateSyncRules({
74
- content: `
83
+ const syncRules = await factory.updateSyncRules(
84
+ updateSyncRulesFromYaml(
85
+ `
75
86
  bucket_definitions:
76
87
  mybucket:
77
88
  parameters:
78
89
  - SELECT group_id FROM test WHERE id = token_parameters.user_id
79
90
  data: []
80
- `
81
- });
91
+ `,
92
+ {
93
+ storageVersion
94
+ }
95
+ )
96
+ );
82
97
  const bucketStorage = factory.getInstance(syncRules);
83
98
 
84
99
  await bucketStorage.startBatch(test_utils.BATCH_OPTIONS, async (batch) => {
100
+ await batch.markAllSnapshotDone('1/1');
85
101
  await batch.save({
86
102
  sourceTable: TEST_TABLE,
87
103
  tag: storage.SaveOperationTag.INSERT,
@@ -126,8 +142,9 @@ bucket_definitions:
126
142
 
127
143
  test('it should use the latest version after updates', async () => {
128
144
  await using factory = await generateStorageFactory();
129
- const syncRules = await factory.updateSyncRules({
130
- content: `
145
+ const syncRules = await factory.updateSyncRules(
146
+ updateSyncRulesFromYaml(
147
+ `
131
148
  bucket_definitions:
132
149
  mybucket:
133
150
  parameters:
@@ -135,13 +152,16 @@ bucket_definitions:
135
152
  FROM todos
136
153
  WHERE list_id IN token_parameters.list_id
137
154
  data: []
138
- `
139
- });
155
+ `,
156
+ { storageVersion }
157
+ )
158
+ );
140
159
  const bucketStorage = factory.getInstance(syncRules);
141
160
 
142
- const table = test_utils.makeTestTable('todos', ['id', 'list_id']);
161
+ const table = test_utils.makeTestTable('todos', ['id', 'list_id'], config);
143
162
 
144
163
  await bucketStorage.startBatch(test_utils.BATCH_OPTIONS, async (batch) => {
164
+ await batch.markAllSnapshotDone('1/1');
145
165
  // Create two todos which initially belong to different lists
146
166
  await batch.save({
147
167
  sourceTable: table,
@@ -201,18 +221,24 @@ bucket_definitions:
201
221
 
202
222
  test('save and load parameters with different number types', async () => {
203
223
  await using factory = await generateStorageFactory();
204
- const syncRules = await factory.updateSyncRules({
205
- content: `
224
+ const syncRules = await factory.updateSyncRules(
225
+ updateSyncRulesFromYaml(
226
+ `
206
227
  bucket_definitions:
207
228
  mybucket:
208
229
  parameters:
209
230
  - SELECT group_id FROM test WHERE n1 = token_parameters.n1 and f2 = token_parameters.f2 and f3 = token_parameters.f3
210
231
  data: []
211
- `
212
- });
232
+ `,
233
+ {
234
+ storageVersion
235
+ }
236
+ )
237
+ );
213
238
  const bucketStorage = factory.getInstance(syncRules);
214
239
 
215
240
  await bucketStorage.startBatch(test_utils.BATCH_OPTIONS, async (batch) => {
241
+ await batch.markAllSnapshotDone('1/1');
216
242
  await batch.save({
217
243
  sourceTable: TEST_TABLE,
218
244
  tag: storage.SaveOperationTag.INSERT,
@@ -251,18 +277,24 @@ bucket_definitions:
251
277
  // test this to ensure correct deserialization.
252
278
 
253
279
  await using factory = await generateStorageFactory();
254
- const syncRules = await factory.updateSyncRules({
255
- content: `
280
+ const syncRules = await factory.updateSyncRules(
281
+ updateSyncRulesFromYaml(
282
+ `
256
283
  bucket_definitions:
257
284
  mybucket:
258
285
  parameters:
259
286
  - SELECT group_id FROM test WHERE n1 = token_parameters.n1
260
287
  data: []
261
- `
262
- });
288
+ `,
289
+ {
290
+ storageVersion
291
+ }
292
+ )
293
+ );
263
294
  const bucketStorage = factory.getInstance(syncRules);
264
295
 
265
296
  await bucketStorage.startBatch(test_utils.BATCH_OPTIONS, async (batch) => {
297
+ await batch.markAllSnapshotDone('1/1');
266
298
  await batch.save({
267
299
  sourceTable: TEST_TABLE,
268
300
  tag: storage.SaveOperationTag.INSERT,
@@ -301,23 +333,29 @@ bucket_definitions:
301
333
  });
302
334
 
303
335
  test('save and load parameters with workspaceId', async () => {
304
- const WORKSPACE_TABLE = test_utils.makeTestTable('workspace', ['id']);
336
+ const WORKSPACE_TABLE = test_utils.makeTestTable('workspace', ['id'], config);
305
337
 
306
338
  await using factory = await generateStorageFactory();
307
- const syncRules = await factory.updateSyncRules({
308
- content: `
339
+ const syncRules = await factory.updateSyncRules(
340
+ updateSyncRulesFromYaml(
341
+ `
309
342
  bucket_definitions:
310
343
  by_workspace:
311
344
  parameters:
312
345
  - SELECT id as workspace_id FROM workspace WHERE
313
346
  workspace."userId" = token_parameters.user_id
314
347
  data: []
315
- `
316
- });
348
+ `,
349
+ {
350
+ storageVersion
351
+ }
352
+ )
353
+ );
317
354
  const sync_rules = syncRules.parsed(test_utils.PARSE_OPTIONS).hydratedSyncRules();
318
355
  const bucketStorage = factory.getInstance(syncRules);
319
356
 
320
357
  await bucketStorage.startBatch(test_utils.BATCH_OPTIONS, async (batch) => {
358
+ await batch.markAllSnapshotDone('1/1');
321
359
  await batch.save({
322
360
  sourceTable: WORKSPACE_TABLE,
323
361
  tag: storage.SaveOperationTag.INSERT,
@@ -337,7 +375,7 @@ bucket_definitions:
337
375
 
338
376
  const buckets = await querier.queryDynamicBucketDescriptions({
339
377
  async getParameterSets(lookups) {
340
- expect(lookups).toEqual([ScopedParameterLookup.direct({ lookupName: 'by_workspace', queryId: '1' }, ['u1'])]);
378
+ expect(lookups).toEqual([ScopedParameterLookup.direct(parameterLookupScope('by_workspace', '1'), ['u1'])]);
341
379
 
342
380
  const parameter_sets = await checkpoint.getParameterSets(lookups);
343
381
  expect(parameter_sets).toEqual([{ workspace_id: 'workspace1' }]);
@@ -345,28 +383,39 @@ bucket_definitions:
345
383
  }
346
384
  });
347
385
  expect(buckets).toEqual([
348
- { bucket: 'by_workspace["workspace1"]', priority: 3, definition: 'by_workspace', inclusion_reasons: ['default'] }
386
+ {
387
+ bucket: bucketRequest(syncRules, 'by_workspace["workspace1"]').bucket,
388
+ priority: 3,
389
+ definition: 'by_workspace',
390
+ inclusion_reasons: ['default']
391
+ }
349
392
  ]);
350
393
  });
351
394
 
352
395
  test('save and load parameters with dynamic global buckets', async () => {
353
- const WORKSPACE_TABLE = test_utils.makeTestTable('workspace');
396
+ const WORKSPACE_TABLE = test_utils.makeTestTable('workspace', undefined, config);
354
397
 
355
398
  await using factory = await generateStorageFactory();
356
- const syncRules = await factory.updateSyncRules({
357
- content: `
399
+ const syncRules = await factory.updateSyncRules(
400
+ updateSyncRulesFromYaml(
401
+ `
358
402
  bucket_definitions:
359
403
  by_public_workspace:
360
404
  parameters:
361
405
  - SELECT id as workspace_id FROM workspace WHERE
362
406
  workspace.visibility = 'public'
363
407
  data: []
364
- `
365
- });
408
+ `,
409
+ {
410
+ storageVersion
411
+ }
412
+ )
413
+ );
366
414
  const sync_rules = syncRules.parsed(test_utils.PARSE_OPTIONS).hydratedSyncRules();
367
415
  const bucketStorage = factory.getInstance(syncRules);
368
416
 
369
417
  await bucketStorage.startBatch(test_utils.BATCH_OPTIONS, async (batch) => {
418
+ await batch.markAllSnapshotDone('1/1');
370
419
  await batch.save({
371
420
  sourceTable: WORKSPACE_TABLE,
372
421
  tag: storage.SaveOperationTag.INSERT,
@@ -408,9 +457,7 @@ bucket_definitions:
408
457
 
409
458
  const buckets = await querier.queryDynamicBucketDescriptions({
410
459
  async getParameterSets(lookups) {
411
- expect(lookups).toEqual([
412
- ScopedParameterLookup.direct({ lookupName: 'by_public_workspace', queryId: '1' }, [])
413
- ]);
460
+ expect(lookups).toEqual([ScopedParameterLookup.direct(parameterLookupScope('by_public_workspace', '1'), [])]);
414
461
 
415
462
  const parameter_sets = await checkpoint.getParameterSets(lookups);
416
463
  parameter_sets.sort((a, b) => JSON.stringify(a).localeCompare(JSON.stringify(b)));
@@ -421,13 +468,13 @@ bucket_definitions:
421
468
  buckets.sort((a, b) => a.bucket.localeCompare(b.bucket));
422
469
  expect(buckets).toEqual([
423
470
  {
424
- bucket: 'by_public_workspace["workspace1"]',
471
+ bucket: bucketRequest(syncRules, 'by_public_workspace["workspace1"]').bucket,
425
472
  priority: 3,
426
473
  definition: 'by_public_workspace',
427
474
  inclusion_reasons: ['default']
428
475
  },
429
476
  {
430
- bucket: 'by_public_workspace["workspace3"]',
477
+ bucket: bucketRequest(syncRules, 'by_public_workspace["workspace3"]').bucket,
431
478
  priority: 3,
432
479
  definition: 'by_public_workspace',
433
480
  inclusion_reasons: ['default']
@@ -436,11 +483,12 @@ bucket_definitions:
436
483
  });
437
484
 
438
485
  test('multiple parameter queries', async () => {
439
- const WORKSPACE_TABLE = test_utils.makeTestTable('workspace');
486
+ const WORKSPACE_TABLE = test_utils.makeTestTable('workspace', undefined, config);
440
487
 
441
488
  await using factory = await generateStorageFactory();
442
- const syncRules = await factory.updateSyncRules({
443
- content: `
489
+ const syncRules = await factory.updateSyncRules(
490
+ updateSyncRulesFromYaml(
491
+ `
444
492
  bucket_definitions:
445
493
  by_workspace:
446
494
  parameters:
@@ -449,12 +497,17 @@ bucket_definitions:
449
497
  - SELECT id as workspace_id FROM workspace WHERE
450
498
  workspace.user_id = token_parameters.user_id
451
499
  data: []
452
- `
453
- });
500
+ `,
501
+ {
502
+ storageVersion
503
+ }
504
+ )
505
+ );
454
506
  const sync_rules = syncRules.parsed(test_utils.PARSE_OPTIONS).hydratedSyncRules();
455
507
  const bucketStorage = factory.getInstance(syncRules);
456
508
 
457
509
  await bucketStorage.startBatch(test_utils.BATCH_OPTIONS, async (batch) => {
510
+ await batch.markAllSnapshotDone('1/1');
458
511
  await batch.save({
459
512
  sourceTable: WORKSPACE_TABLE,
460
513
  tag: storage.SaveOperationTag.INSERT,
@@ -521,30 +574,39 @@ bucket_definitions:
521
574
  })
522
575
  ).map((e) => e.bucket);
523
576
  expect(foundLookups).toEqual([
524
- ScopedParameterLookup.direct({ lookupName: 'by_workspace', queryId: '1' }, []),
525
- ScopedParameterLookup.direct({ lookupName: 'by_workspace', queryId: '2' }, ['u1'])
577
+ ScopedParameterLookup.direct(parameterLookupScope('by_workspace', '1'), []),
578
+ ScopedParameterLookup.direct(parameterLookupScope('by_workspace', '2'), ['u1'])
526
579
  ]);
527
580
  parameter_sets.sort((a, b) => JSON.stringify(a).localeCompare(JSON.stringify(b)));
528
581
  expect(parameter_sets).toEqual([{ workspace_id: 'workspace1' }, { workspace_id: 'workspace3' }]);
529
582
 
530
583
  buckets.sort();
531
- expect(buckets).toEqual(['by_workspace["workspace1"]', 'by_workspace["workspace3"]']);
584
+ expect(buckets).toEqual([
585
+ bucketRequest(syncRules, 'by_workspace["workspace1"]').bucket,
586
+ bucketRequest(syncRules, 'by_workspace["workspace3"]').bucket
587
+ ]);
532
588
  });
533
589
 
534
590
  test('truncate parameters', async () => {
535
591
  await using factory = await generateStorageFactory();
536
- const syncRules = await factory.updateSyncRules({
537
- content: `
592
+ const syncRules = await factory.updateSyncRules(
593
+ updateSyncRulesFromYaml(
594
+ `
538
595
  bucket_definitions:
539
596
  mybucket:
540
597
  parameters:
541
598
  - SELECT group_id FROM test WHERE id1 = token_parameters.user_id OR id2 = token_parameters.user_id
542
599
  data: []
543
- `
544
- });
600
+ `,
601
+ {
602
+ storageVersion
603
+ }
604
+ )
605
+ );
545
606
  const bucketStorage = factory.getInstance(syncRules);
546
607
 
547
608
  await bucketStorage.startBatch(test_utils.BATCH_OPTIONS, async (batch) => {
609
+ await batch.markAllSnapshotDone('1/1');
548
610
  await batch.save({
549
611
  sourceTable: TEST_TABLE,
550
612
  tag: storage.SaveOperationTag.INSERT,
@@ -568,16 +630,21 @@ bucket_definitions:
568
630
 
569
631
  test('invalidate cached parsed sync rules', async () => {
570
632
  await using bucketStorageFactory = await generateStorageFactory();
571
- const syncRules = await bucketStorageFactory.updateSyncRules({
572
- content: `
633
+ const syncRules = await bucketStorageFactory.updateSyncRules(
634
+ updateSyncRulesFromYaml(
635
+ `
573
636
  bucket_definitions:
574
637
  by_workspace:
575
638
  parameters:
576
639
  - SELECT id as workspace_id FROM workspace WHERE
577
640
  workspace."userId" = token_parameters.user_id
578
641
  data: []
579
- `
580
- });
642
+ `,
643
+ {
644
+ storageVersion
645
+ }
646
+ )
647
+ );
581
648
  const syncBucketStorage = bucketStorageFactory.getInstance(syncRules);
582
649
 
583
650
  const parsedSchema1 = syncBucketStorage.getParsedSyncRules({
@@ -600,4 +667,46 @@ bucket_definitions:
600
667
  expect(parsedSchema3).not.equals(parsedSchema2);
601
668
  expect(parsedSchema3.getSourceTables()[0].schema).equals('databasename');
602
669
  });
670
+
671
+ test('sync streams smoke test', async () => {
672
+ await using factory = await generateStorageFactory();
673
+ const syncRules = await factory.updateSyncRules(
674
+ updateSyncRulesFromYaml(`
675
+ config:
676
+ edition: 3
677
+
678
+ streams:
679
+ stream:
680
+ query: |
681
+ SELECT data.* FROM test AS data, test AS param
682
+ WHERE data.foo = param.bar AND param.baz = auth.user_id()
683
+ `)
684
+ );
685
+ const bucketStorage = factory.getInstance(syncRules);
686
+
687
+ await bucketStorage.startBatch(test_utils.BATCH_OPTIONS, async (batch) => {
688
+ await batch.markAllSnapshotDone('1/1');
689
+ await batch.save({
690
+ sourceTable: TEST_TABLE,
691
+ tag: storage.SaveOperationTag.INSERT,
692
+ after: {
693
+ baz: 'baz',
694
+ bar: 'bar'
695
+ },
696
+ afterReplicaId: test_utils.rid('t1')
697
+ });
698
+
699
+ await batch.commit('1/1');
700
+ });
701
+
702
+ const checkpoint = await bucketStorage.getCheckpoint();
703
+ const parameters = await checkpoint.getParameterSets([
704
+ ScopedParameterLookup.direct(parameterLookupScope('lookup', '0'), ['baz'])
705
+ ]);
706
+ expect(parameters).toEqual([
707
+ {
708
+ '0': 'bar'
709
+ }
710
+ ]);
711
+ });
603
712
  }
@@ -1,24 +1,28 @@
1
- import { storage } from '@powersync/service-core';
1
+ import { storage, updateSyncRulesFromYaml } from '@powersync/service-core';
2
2
  import { ScopedParameterLookup } from '@powersync/service-sync-rules';
3
3
  import { expect, test } from 'vitest';
4
4
  import * as test_utils from '../test-utils/test-utils-index.js';
5
+ import { parameterLookupScope } from './util.js';
5
6
 
6
- const TEST_TABLE = test_utils.makeTestTable('test', ['id']);
7
+ export function registerParameterCompactTests(config: storage.TestStorageConfig) {
8
+ const generateStorageFactory = config.factory;
9
+
10
+ const TEST_TABLE = test_utils.makeTestTable('test', ['id'], config);
7
11
 
8
- export function registerParameterCompactTests(generateStorageFactory: storage.TestStorageFactory) {
9
12
  test('compacting parameters', async () => {
10
13
  await using factory = await generateStorageFactory();
11
- const syncRules = await factory.updateSyncRules({
12
- content: `
14
+ const syncRules = await factory.updateSyncRules(
15
+ updateSyncRulesFromYaml(`
13
16
  bucket_definitions:
14
17
  test:
15
18
  parameters: select id from test where id = request.user_id()
16
19
  data: []
17
- `
18
- });
20
+ `)
21
+ );
19
22
  const bucketStorage = factory.getInstance(syncRules);
20
23
 
21
24
  await bucketStorage.startBatch(test_utils.BATCH_OPTIONS, async (batch) => {
25
+ await batch.markAllSnapshotDone('1/1');
22
26
  await batch.save({
23
27
  sourceTable: TEST_TABLE,
24
28
  tag: storage.SaveOperationTag.INSERT,
@@ -40,7 +44,7 @@ bucket_definitions:
40
44
  await batch.commit('1/1');
41
45
  });
42
46
 
43
- const lookup = ScopedParameterLookup.direct({ lookupName: 'test', queryId: '1' }, ['t1']);
47
+ const lookup = ScopedParameterLookup.direct(parameterLookupScope('test', '1'), ['t1']);
44
48
 
45
49
  const checkpoint1 = await bucketStorage.getCheckpoint();
46
50
  const parameters1 = await checkpoint1.getParameterSets([lookup]);
@@ -91,17 +95,18 @@ bucket_definitions:
91
95
  for (let cacheLimit of [1, 10]) {
92
96
  test(`compacting deleted parameters with cache size ${cacheLimit}`, async () => {
93
97
  await using factory = await generateStorageFactory();
94
- const syncRules = await factory.updateSyncRules({
95
- content: `
98
+ const syncRules = await factory.updateSyncRules(
99
+ updateSyncRulesFromYaml(`
96
100
  bucket_definitions:
97
101
  test:
98
102
  parameters: select id from test where uid = request.user_id()
99
103
  data: []
100
- `
101
- });
104
+ `)
105
+ );
102
106
  const bucketStorage = factory.getInstance(syncRules);
103
107
 
104
108
  await bucketStorage.startBatch(test_utils.BATCH_OPTIONS, async (batch) => {
109
+ await batch.markAllSnapshotDone('1/1');
105
110
  await batch.save({
106
111
  sourceTable: TEST_TABLE,
107
112
  tag: storage.SaveOperationTag.INSERT,
@@ -151,7 +156,7 @@ bucket_definitions:
151
156
  await batch.commit('3/1');
152
157
  });
153
158
 
154
- const lookup = ScopedParameterLookup.direct({ lookupName: 'test', queryId: '1' }, ['u1']);
159
+ const lookup = ScopedParameterLookup.direct(parameterLookupScope('test', '1'), ['u1']);
155
160
 
156
161
  const checkpoint1 = await bucketStorage.getCheckpoint();
157
162
  const parameters1 = await checkpoint1.getParameterSets([lookup]);