mirror of
https://github.com/block/buzz.git
synced 2026-11-01 06:51:17 +00:00
test(desktop): await agent inventory observer updates
Co-authored-by: Sarnow <1894dcbafaa4df1ac607a9bf879ac0b7d77fbccb0e0f4619ecc252c8adbad8a2@seiler-test.communities.public.builderlabstaging.xyz> Signed-off-by: Brad Seiler <seiler@squareup.com>
This commit is contained in:
@@ -20,7 +20,9 @@ Object.assign(globalThis, {
|
||||
after(() => dom.window.close());
|
||||
|
||||
test("provenance context follows exact local inventory and rejects failed cached reads", async () => {
|
||||
const { act, renderHook, cleanup } = await import("@testing-library/react");
|
||||
const { act, renderHook, cleanup, waitFor } = await import(
|
||||
"@testing-library/react"
|
||||
);
|
||||
const owner = "a".repeat(64),
|
||||
remote = "b".repeat(64),
|
||||
local = "c".repeat(64);
|
||||
@@ -59,15 +61,14 @@ test("provenance context follows exact local inventory and rejects failed cached
|
||||
[{ pubkey: remote, status: "deployed" }],
|
||||
),
|
||||
);
|
||||
assert.deepEqual(result.current, [false, true, true]);
|
||||
await waitFor(() => assert.deepEqual(result.current, [false, true, true]));
|
||||
await act(async () => {
|
||||
client
|
||||
.getQueryCache()
|
||||
.find({ queryKey: ["managed-agents"] })
|
||||
.setState({ error: new Error("inventory unavailable"), status: "error" });
|
||||
await new Promise((resolve) => setTimeout(resolve, 5));
|
||||
});
|
||||
assert.deepEqual(result.current, [false, false, false]);
|
||||
await waitFor(() => assert.deepEqual(result.current, [false, false, false]));
|
||||
cleanup();
|
||||
client.clear();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user