evOo-local/apps/desktop/src/window-open.test.ts
cynarAI 6c7eed7580 Initial clean evOo-local from f00577b
Fresh history cut from cynarAI/evoo antigravity-handoff/project-timeline
(Voice First + project timeline). Brand docs/titles as evOo; keep @rakazo/*
packages as tech debt. Excludes node_modules, caches, secrets, voice blobs.
2026-09-20 17:15:16 +02:00

35 lines
1.1 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { shouldOpenInAppPopup } from "./window-open.js";
const appOrigin = "https://rakazo.example.com";
describe("desktop child windows", () => {
it("keeps same-origin app routes in Electron", () => {
expect(shouldOpenInAppPopup(appOrigin, `${appOrigin}/mcp/oauth/callback`, "_blank")).toBe(true);
});
it("opens ordinary external links outside Electron", () => {
expect(
shouldOpenInAppPopup(appOrigin, "https://github.com/elie222/rakazo/pull/395", "_blank"),
).toBe(false);
});
it.each([
"rakazo-model-oauth",
"rakazo-mcp-oauth",
"rakazo-app-connect",
"rakazo-plugin-connect",
])("keeps the intentional %s flow in an Electron popup", (frameName) => {
expect(
shouldOpenInAppPopup(appOrigin, "https://provider.example.com/authorize", frameName),
).toBe(true);
});
it("rejects malformed URLs and non-HTTPS third-party targets", () => {
expect(shouldOpenInAppPopup(appOrigin, "not a url", "rakazo-model-oauth")).toBe(false);
expect(
shouldOpenInAppPopup(appOrigin, "http://provider.example.com", "rakazo-model-oauth"),
).toBe(false);
});
});