mark electron renderer for codex bridge
This commit is contained in:
parent
31a8e07a5b
commit
a54e847c8e
5 changed files with 82 additions and 17 deletions
|
|
@ -2,6 +2,7 @@ import { describe, expect, it } from "bun:test";
|
|||
|
||||
import {
|
||||
createUnavailableState,
|
||||
detectDesktopRuntimeMarker,
|
||||
detectDesktopShell,
|
||||
resolveDesktopAiRuntime,
|
||||
} from "./desktop-ai";
|
||||
|
|
@ -18,6 +19,22 @@ import {
|
|||
} from "./desktop-ai-panels";
|
||||
|
||||
describe("desktop ai runtime detection", () => {
|
||||
it("recognizes the explicit desktop preload marker before the bridge is available", () => {
|
||||
const runtime = resolveDesktopAiRuntime({
|
||||
islandflowDesktopRuntime: {
|
||||
app: "islandflow",
|
||||
shell: "electron",
|
||||
},
|
||||
navigator: {
|
||||
userAgent: "Mozilla/5.0 Safari/537.36",
|
||||
},
|
||||
});
|
||||
|
||||
expect(runtime.shellAvailable).toBe(true);
|
||||
expect(runtime.bridgeAvailable).toBe(false);
|
||||
expect(runtime.bridge).toBeNull();
|
||||
});
|
||||
|
||||
it("recognizes Electron user agents before the bridge is available", () => {
|
||||
const runtime = resolveDesktopAiRuntime({
|
||||
navigator: {
|
||||
|
|
@ -102,8 +119,20 @@ describe("desktop action copy", () => {
|
|||
});
|
||||
|
||||
describe("desktop shell detection", () => {
|
||||
it("matches the explicit preload runtime marker", () => {
|
||||
expect(
|
||||
detectDesktopRuntimeMarker({ app: "islandflow", shell: "electron" }),
|
||||
).toBe(true);
|
||||
expect(
|
||||
detectDesktopRuntimeMarker({ app: "islandflow", shell: "browser" }),
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it("matches Electron signatures", () => {
|
||||
expect(detectDesktopShell("Mozilla/5.0 Electron/39.0.0")).toBe(true);
|
||||
expect(detectDesktopShell("Mozilla/5.0 IslandflowDesktop/0.1.0")).toBe(
|
||||
true,
|
||||
);
|
||||
expect(
|
||||
detectDesktopShell("Mozilla/5.0 Chrome/136.0.0.0 Safari/537.36"),
|
||||
).toBe(false);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue