Skip to content

Commit c635c9f

Browse files
committed
Don't set uploading unecessarily
1 parent 985baa3 commit c635c9f

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

packages/node/tests/sync.test.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,26 @@ function defineSyncTests(impl: SyncClientImplementation) {
158158
await vi.waitFor(() => expect(database.currentStatus.dataFlowStatus.downloading).toBeTruthy());
159159
});
160160

161+
mockSyncServiceTest('does not set uploading status without local writes', async ({ syncService }) => {
162+
const database = await syncService.createDatabase();
163+
database.registerListener({
164+
statusChanged(status) {
165+
expect(status.dataFlowStatus.uploading).toBeFalsy();
166+
}
167+
});
168+
169+
database.connect(new TestConnector(), options);
170+
await vi.waitFor(() => expect(syncService.connectedListeners).toHaveLength(1));
171+
172+
syncService.pushLine({
173+
checkpoint: {
174+
last_op_id: '10',
175+
buckets: [bucket('a', 10)]
176+
}
177+
});
178+
await vi.waitFor(() => expect(database.currentStatus.dataFlowStatus.downloading).toBeTruthy());
179+
});
180+
161181
describe('reports progress', () => {
162182
let lastOpId = 0;
163183

0 commit comments

Comments
 (0)