Skip to content

Commit 3d57e28

Browse files
fix upload test
1 parent 57289b7 commit 3d57e28

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

packages/web/src/worker/sync/SharedSyncImplementation.ts

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -164,15 +164,15 @@ export class SharedSyncImplementation
164164
}
165165

166166
async waitForStatus(status: SyncStatusOptions): Promise<void> {
167-
await this.waitForReady();
168-
// TODO
169-
return this.connectionManager.syncStreamImplementation!.waitForStatus(status);
167+
return this.withSyncImplementation(async (sync) => {
168+
return sync.waitForStatus(status);
169+
});
170170
}
171171

172172
async waitUntilStatusMatches(predicate: (status: SyncStatus) => boolean): Promise<void> {
173-
await this.waitForReady();
174-
// TODO
175-
return this.connectionManager.syncStreamImplementation!.waitUntilStatusMatches(predicate);
173+
return this.withSyncImplementation(async (sync) => {
174+
return sync.waitUntilStatusMatches(predicate);
175+
});
176176
}
177177

178178
async waitForReady() {
@@ -455,6 +455,13 @@ export class SharedSyncImplementation
455455
* sync stream client and all tab client's sync status
456456
*/
457457
private _testUpdateAllStatuses(status: SyncStatusOptions) {
458+
if (!this.connectionManager.syncStreamImplementation) {
459+
// This is just for testing purposes
460+
this.connectionManager.syncStreamImplementation = this.generateStreamingImplementation();
461+
}
462+
463+
// Only assigning, don't call listeners for this test
464+
this.connectionManager.syncStreamImplementation!.syncStatus = new SyncStatus(status);
458465
this.updateAllStatuses(status);
459466
}
460467
}

0 commit comments

Comments
 (0)