Skip to content

Commit dcc1491

Browse files
committed
Don't set uploading unecessarily
1 parent 6fe2f63 commit dcc1491

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
@@ -135,6 +135,26 @@ function defineSyncTests(impl: SyncClientImplementation) {
135135
await vi.waitFor(() => expect(database.currentStatus.dataFlowStatus.downloading).toBeTruthy());
136136
});
137137

138+
mockSyncServiceTest('does not set uploading status without local writes', async ({ syncService }) => {
139+
const database = await syncService.createDatabase();
140+
database.registerListener({
141+
statusChanged(status) {
142+
expect(status.dataFlowStatus.uploading).toBeFalsy();
143+
}
144+
});
145+
146+
database.connect(new TestConnector(), options);
147+
await vi.waitFor(() => expect(syncService.connectedListeners).toHaveLength(1));
148+
149+
syncService.pushLine({
150+
checkpoint: {
151+
last_op_id: '10',
152+
buckets: [bucket('a', 10)]
153+
}
154+
});
155+
await vi.waitFor(() => expect(database.currentStatus.dataFlowStatus.downloading).toBeTruthy());
156+
});
157+
138158
describe('reports progress', () => {
139159
let lastOpId = 0;
140160

0 commit comments

Comments
 (0)