Skip to content

Commit 67c6a37

Browse files
committed
Add timeout to failing test
1 parent ee6690a commit 67c6a37

File tree

1 file changed

+34
-30
lines changed

1 file changed

+34
-30
lines changed

packages/node/tests/sync.test.ts

Lines changed: 34 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -224,40 +224,44 @@ function defineSyncTests(impl: SyncClientImplementation) {
224224
}
225225
}
226226

227-
mockSyncServiceTest('without priorities', async ({ syncService }) => {
228-
const database = await syncService.createDatabase();
229-
database.connect(new TestConnector(), options);
230-
await vi.waitFor(() => expect(syncService.connectedListeners).toHaveLength(1));
231-
232-
syncService.pushLine({
233-
checkpoint: {
234-
last_op_id: '10',
235-
buckets: [bucket('a', 10)]
236-
}
237-
});
227+
mockSyncServiceTest(
228+
'without priorities',
229+
async ({ syncService }) => {
230+
const database = await syncService.createDatabase();
231+
database.connect(new TestConnector(), options);
232+
await vi.waitFor(() => expect(syncService.connectedListeners).toHaveLength(1));
233+
234+
syncService.pushLine({
235+
checkpoint: {
236+
last_op_id: '10',
237+
buckets: [bucket('a', 10)]
238+
}
239+
});
238240

239-
await waitForProgress(database, [0, 10]);
241+
await waitForProgress(database, [0, 10]);
240242

241-
pushDataLine(syncService, 'a', 10);
242-
await waitForProgress(database, [10, 10]);
243+
pushDataLine(syncService, 'a', 10);
244+
await waitForProgress(database, [10, 10]);
243245

244-
pushCheckpointComplete(syncService);
245-
await waitForSyncStatus(database, (s) => s.downloadProgress == null);
246+
pushCheckpointComplete(syncService);
247+
await waitForSyncStatus(database, (s) => s.downloadProgress == null);
246248

247-
// Emit new data, progress should be 0/2 instead of 10/12
248-
syncService.pushLine({
249-
checkpoint_diff: {
250-
last_op_id: '12',
251-
updated_buckets: [bucket('a', 12)],
252-
removed_buckets: []
253-
}
254-
});
255-
await waitForProgress(database, [0, 2]);
256-
pushDataLine(syncService, 'a', 2);
257-
await waitForProgress(database, [2, 2]);
258-
pushCheckpointComplete(syncService);
259-
await waitForSyncStatus(database, (s) => s.downloadProgress == null);
260-
});
249+
// Emit new data, progress should be 0/2 instead of 10/12
250+
syncService.pushLine({
251+
checkpoint_diff: {
252+
last_op_id: '12',
253+
updated_buckets: [bucket('a', 12)],
254+
removed_buckets: []
255+
}
256+
});
257+
await waitForProgress(database, [0, 2]);
258+
pushDataLine(syncService, 'a', 2);
259+
await waitForProgress(database, [2, 2]);
260+
pushCheckpointComplete(syncService);
261+
await waitForSyncStatus(database, (s) => s.downloadProgress == null);
262+
},
263+
{ timeout: 10000 }
264+
);
261265

262266
mockSyncServiceTest('interrupted sync', async ({ syncService }) => {
263267
let database = await syncService.createDatabase();

0 commit comments

Comments
 (0)