Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

Updater test: the app's folders are a temp folder per test (#4981)

Milind Sonieb26be2e5b5f
diff --git a/electron/updater.test.mjs b/electron/updater.test.mjs
index 8dbd304909..f8bbfe3dff 100644
--- a/electron/updater.test.mjs
+++ b/electron/updater.test.mjs
@@ -16,10 +16,10 @@ const CLOUD = "https://home-7f3k2.fly.dev";
const OTHER = "https://bots.example.test";
const OWN = "https://omb-c-a.fly.dev";
-const fixture = vi.hoisted(() => ({ autoUpdater: null, handlers: new Map() }));
+const fixture = vi.hoisted(() => ({ autoUpdater: null, handlers: new Map(), home: "" }));
vi.mock("electron", () => ({
- app: { isPackaged: true, getPath: () => "/unused-updater-test-log", getVersion: () => "1.0.0", hide: vi.fn() },
+ app: { isPackaged: true, getPath: () => fixture.home, getVersion: () => "1.0.0", hide: vi.fn() },
clipboard: { writeText: vi.fn() },
ipcMain: { handle: (name, handler) => fixture.handlers.set(name, handler) },
}));
@@ -120,12 +120,14 @@ const settle = async () => {
};
beforeEach(() => {
+ fixture.home = mkdtempSync(join(tmpdir(), "omb-updater-home-"));
localOriginModule.setLocalOrigin(LOCAL);
vi.useFakeTimers();
});
afterEach(() => {
vi.clearAllTimers();
vi.useRealTimers();
+ rmSync(fixture.home, { recursive: true, force: true });
});
function bridgeFor(origin, { clicked = false, rule = null } = {}) {