@@ -41,7 +41,7 @@ describe('Multiple Instances', { sequential: true }, () => {
4141 sharedMockSyncServiceTest (
4242 'should broadcast logs from shared sync worker' ,
4343 { timeout : 10_000 } ,
44- async ( { context : { database , connect , openDatabase } } ) => {
44+ async ( { context : { openDatabase } } ) => {
4545 const logger = createLogger ( 'test-logger' ) ;
4646 const spiedErrorLogger = vi . spyOn ( logger , 'error' ) ;
4747 const spiedDebugLogger = vi . spyOn ( logger , 'debug' ) ;
@@ -61,18 +61,6 @@ describe('Multiple Instances', { sequential: true }, () => {
6161 uploadData : async ( db ) => { }
6262 } ) ;
6363
64- // Should log that a connection attempt has been made
65- const message = 'Streaming sync iteration started' ;
66- await vi . waitFor (
67- ( ) =>
68- expect (
69- spiedDebugLogger . mock . calls
70- . flat ( 1 )
71- . find ( ( argument ) => typeof argument == 'string' && argument . includes ( message ) )
72- ) . exist ,
73- { timeout : 2000 }
74- ) ;
75-
7664 await vi . waitFor ( async ( ) => {
7765 const syncService = await getMockSyncServiceFromWorker ( powersync . database . name ) ;
7866 if ( ! syncService ) {
@@ -86,6 +74,18 @@ describe('Multiple Instances', { sequential: true }, () => {
8674 await syncService . completeResponse ( pendingRequestId ) ;
8775 } ) ;
8876
77+ // Should log that a connection attempt has been made
78+ const message = 'Streaming sync iteration started' ;
79+ await vi . waitFor (
80+ ( ) =>
81+ expect (
82+ spiedDebugLogger . mock . calls
83+ . flat ( 1 )
84+ . find ( ( argument ) => typeof argument == 'string' && argument . includes ( message ) )
85+ ) . exist ,
86+ { timeout : 2000 }
87+ ) ;
88+
8989 // The connection should fail with an error
9090 await vi . waitFor ( ( ) => expect ( spiedErrorLogger . mock . calls . length ) . gt ( 0 ) , { timeout : 2000 } ) ;
9191 }
@@ -232,7 +232,7 @@ describe('Multiple Instances', { sequential: true }, () => {
232232 // connect the second database in order for it to have access to the sync service.
233233 secondDatabase . connect ( createTestConnector ( ) ) ;
234234 // Timing of this can be tricky due to the need for responding to a pending request.
235- await vi . waitFor ( ( ) => expect ( secondDatabase . currentStatus . connecting ) . true ) ;
235+ await vi . waitFor ( ( ) => expect ( secondDatabase . currentStatus . connecting ) . true , { timeout : 2000 } ) ;
236236 // connect the first database - this will actually connect to the sync service.
237237 await connect ( ) ;
238238
0 commit comments