Skip to content

Commit 0bbf9f5

Browse files
committed
test(ui): await device migration overlay updates
1 parent cdf6d2b commit 0bbf9f5

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

‎ui/src/app/overlays.test.ts‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,14 @@ describe("device-auth upgrade migration", () => {
7676
const request = vi.fn<RequestFn>(() => Promise.resolve({}));
7777
const harness = createGatewayHarness(null, false);
7878
const overlays = createApplicationOverlays(harness.gateway);
79+
const migrationError = new Promise<string>((resolve) => {
80+
const unsubscribe = overlays.subscribe((snapshot) => {
81+
if (snapshot.deviceAuthMigration.error) {
82+
unsubscribe();
83+
resolve(snapshot.deviceAuthMigration.error);
84+
}
85+
});
86+
});
7987
harness.update({
8088
client: client(request),
8189
phase: "connected",
@@ -85,9 +93,7 @@ describe("device-auth upgrade migration", () => {
8593
} as ApplicationGatewaySnapshot["hello"],
8694
});
8795

88-
await vi.waitFor(() => {
89-
expect(overlays.snapshot.deviceAuthMigration.error).toContain("HTTPS or localhost");
90-
});
96+
await expect(migrationError).resolves.toContain("HTTPS or localhost");
9197
expect(overlays.snapshot.deviceAuthMigration.requestId).toBeNull();
9298
expect(request).not.toHaveBeenCalledWith("device.pair.list", expect.anything());
9399
overlays.dispose();

0 commit comments

Comments
 (0)