diff --git a/scripts/check-hex.js b/scripts/check-hex.js index cad3d23d..3874779d 100755 --- a/scripts/check-hex.js +++ b/scripts/check-hex.js @@ -8,54 +8,61 @@ import { spawnSync } from "node:child_process"; const SEARCH_PATTERN = '(? { if (dom) dom.cleanup(); }); + beforeEach(() => { + // Ensure clean DOM state + if (global.document && global.document.body) { + global.document.body.innerHTML = ''; + } + }); + it("should detect default R2 connection and show summary when loaded and unlocked", async () => { // Setup Mock Data const pubkey = "pk1"; @@ -170,13 +177,10 @@ describe("UploadModal Integration", () => { meta: { bucket: "locked-bucket" } }]; - // Setup DOM - Reuse existing container or create if missing (cleaned by load) - let container = document.getElementById("modalContainer"); - if (!container) { - container = document.createElement("div"); - container.id = "modalContainer"; - document.body.appendChild(container); - } + // Setup DOM - Create new container + const container = document.createElement("div"); + container.id = "modalContainer"; + document.body.appendChild(container); // Re-instantiate const modal = new UploadModal({