11import { describe , expect , test } from 'vitest' ;
22import { env } from './env.js' ;
33import { createTestTableWithBasicId , describeWithStorage , waitForPendingCDCChanges } from './util.js' ;
4- import { TestStorageFactory } from '@powersync/service-core' ;
4+ import { TestStorageConfig , TestStorageFactory } from '@powersync/service-core' ;
55import { METRICS_HELPER } from '@powersync/service-core-tests' ;
66import { ReplicationMetric } from '@powersync/service-types' ;
77import * as timers from 'node:timers/promises' ;
@@ -10,19 +10,19 @@ import { CDCStreamTestContext } from './CDCStreamTestContext.js';
1010import { getLatestLSN } from '@module/utils/mssql.js' ;
1111
1212describe . skipIf ( ! ( env . CI || env . SLOW_TESTS ) ) ( 'batch replication' , function ( ) {
13- describeWithStorage ( { timeout : 240_000 } , function ( factory ) {
13+ describeWithStorage ( { timeout : 240_000 } , function ( config ) {
1414 test ( 'resuming initial replication (1)' , async ( ) => {
1515 // Stop early - likely to not include deleted row in first replication attempt.
16- await testResumingReplication ( factory , 2000 ) ;
16+ await testResumingReplication ( config , 2000 ) ;
1717 } ) ;
1818 test ( 'resuming initial replication (2)' , async ( ) => {
1919 // Stop late - likely to include deleted row in first replication attempt.
20- await testResumingReplication ( factory , 8000 ) ;
20+ await testResumingReplication ( config , 8000 ) ;
2121 } ) ;
2222 } ) ;
2323} ) ;
2424
25- async function testResumingReplication ( factory : TestStorageFactory , stopAfter : number ) {
25+ async function testResumingReplication ( config : TestStorageConfig , stopAfter : number ) {
2626 // This tests interrupting and then resuming initial replication.
2727 // We interrupt replication after test_data1 has fully replicated, and
2828 // test_data2 has partially replicated.
@@ -34,7 +34,9 @@ async function testResumingReplication(factory: TestStorageFactory, stopAfter: n
3434 // have been / have not been replicated at that point is not deterministic.
3535 // We do allow for some variation in the test results to account for this.
3636
37- await using context = await CDCStreamTestContext . open ( factory , { cdcStreamOptions : { snapshotBatchSize : 1000 } } ) ;
37+ await using context = await CDCStreamTestContext . open ( config . factory , {
38+ cdcStreamOptions : { snapshotBatchSize : 1000 }
39+ } ) ;
3840
3941 await context . updateSyncRules ( `bucket_definitions:
4042 global:
@@ -80,7 +82,7 @@ async function testResumingReplication(factory: TestStorageFactory, stopAfter: n
8082 }
8183
8284 // Bypass the usual "clear db on factory open" step.
83- await using context2 = await CDCStreamTestContext . open ( factory , {
85+ await using context2 = await CDCStreamTestContext . open ( config . factory , {
8486 doNotClear : true ,
8587 cdcStreamOptions : { snapshotBatchSize : 1000 }
8688 } ) ;
0 commit comments