test: tighten gateway readiness assertions

This commit is contained in:
Peter Steinberger
2026-05-11 13:01:18 +01:00
parent 8f1e6ab13c
commit 776c39b00c
2 changed files with 9 additions and 4 deletions

View File

@@ -16,7 +16,9 @@ describe("startGatewayClientWhenEventLoopReady", () => {
await vi.advanceTimersByTimeAsync(1);
expect(client.start).not.toHaveBeenCalled();
await vi.advanceTimersByTimeAsync(1);
await expect(promise).resolves.toMatchObject({ ready: true });
const readiness = await promise;
expect(readiness.ready).toBe(true);
expect(readiness.aborted).toBe(false);
expect(client.start).toHaveBeenCalledTimes(1);
});
@@ -32,7 +34,9 @@ describe("startGatewayClientWhenEventLoopReady", () => {
});
controller.abort();
await expect(promise).resolves.toMatchObject({ ready: false, aborted: true });
const readiness = await promise;
expect(readiness.ready).toBe(false);
expect(readiness.aborted).toBe(true);
expect(client.start).not.toHaveBeenCalled();
});
});

View File

@@ -36,7 +36,8 @@ describe("gateway device.pair.approve superseded request ids", () => {
expect(latestApprove?.status).toBe("approved");
const paired = await getPairedDevice("supersede-device-1");
expect(paired?.roles).toEqual(expect.arrayContaining(["node", "operator"]));
expect(paired?.scopes).toEqual(expect.arrayContaining(["operator.admin"]));
expect(paired?.roles).toContain("node");
expect(paired?.roles).toContain("operator");
expect(paired?.scopes).toContain("operator.admin");
});
});