First Release of Claw3D (#11)

Co-authored-by: iamlukethedev <iamlukethedev@users.noreply.github.com>
This commit is contained in:
Luke The Dev
2026-03-19 23:14:04 -05:00
committed by GitHub
parent 5ea96b2650
commit 4fa4f13558
431 changed files with 105438 additions and 14 deletions
+31
View File
@@ -0,0 +1,31 @@
import { describe, expect, it } from "vitest";
import {
normalizeBrowserPreviewUrl,
resolveBrowserControlBaseUrl,
shouldPreferBrowserScreenshot,
} from "@/lib/office/browserPreview";
describe("browserPreview helpers", () => {
it("prefers screenshots for frame-blocked social sites", () => {
expect(shouldPreferBrowserScreenshot("https://x.com/example-user")).toBe(true);
expect(shouldPreferBrowserScreenshot("https://www.linkedin.com/in/example")).toBe(true);
expect(shouldPreferBrowserScreenshot("https://example.com/dashboard")).toBe(false);
});
it("derives the local browser control service url from the gateway websocket url", () => {
expect(resolveBrowserControlBaseUrl("ws://localhost:18789")).toBe("http://localhost:18791");
expect(resolveBrowserControlBaseUrl("ws://0.0.0.0:19000")).toBe("http://127.0.0.1:19002");
expect(resolveBrowserControlBaseUrl("wss://localhost:443")).toBe("https://localhost:445");
});
it("ignores non-local gateway urls", () => {
expect(resolveBrowserControlBaseUrl("ws://10.0.0.42:18789")).toBeNull();
});
it("normalizes hash-only browser url differences", () => {
expect(
normalizeBrowserPreviewUrl("https://example.com/dashboard#section-a"),
).toBe("https://example.com/dashboard");
});
});