Skip to content

#1 Persistent memory for AI coding agents based on real-world benchmarks

fix(test): stub history + removeAttribute in viewer sandbox (#445)

Rohit Ghumarec93c715043eb
diff --git a/test/viewer-session-id.test.ts b/test/viewer-session-id.test.ts
index 4450d0ce..9938a753 100644
--- a/test/viewer-session-id.test.ts
+++ b/test/viewer-session-id.test.ts
@@ -53,6 +53,12 @@ function loadViewerSandbox() {
setAttribute: (name: string, value: unknown) => {
attributes.set(name, String(value));
},
+ // Added in #313 — switchTab toggles aria-selected via removeAttribute
+ // on the non-active tab buttons. The mock previously only had
+ // get/setAttribute, so the new hash-routing path threw TypeError.
+ removeAttribute: (name: string) => {
+ attributes.delete(name);
+ },
querySelectorAll: () => [],
};
};
@@ -118,6 +124,16 @@ function loadViewerSandbox() {
matchMedia: () => ({ matches: false }),
addEventListener: () => {},
},
+ // Stubbed in #313 — the viewer now calls history.replaceState
+ // inside updateTabRoute → switchTab to drive the hash-route surface.
+ // The vm sandbox is otherwise zero-globals so the call would
+ // throw ReferenceError. No-op is fine for the rendering tests.
+ history: { replaceState: () => {}, pushState: () => {} },
+ location: {
+ hash: "",
+ pathname: "/",
+ search: "",
+ },
localStorage: { getItem: () => null, setItem: () => {} },
fetch: async () => ({ ok: true, json: async () => ({}) }),
WebSocket: function WebSocket() {},