Cover ws native API singleton caching behavior

Co-authored-by: Theo Browne <[email protected]>
This commit is contained in:
Cursor AgentandTheo Browne committed 2026-02-09 23:19:58 +00:00
1 parent 45fcdef07f
commit f7f9f144e7
1 file changed
+10
+10
View File
@@ -197,4 +197,14 @@ describe("wsNativeApi", () => {
await expect(request).rejects.toThrow("websocket disconnected");
});
it("returns a stable cached native API instance", async () => {
setWindowSearch("?ws=ws%3A%2F%2F127.0.0.1%3A4404");
const { getOrCreateWsNativeApi } = await import("./wsNativeApi");
const first = getOrCreateWsNativeApi();
const second = getOrCreateWsNativeApi();
expect(second).toBe(first);
});
});