Files
deerflow-code/frontend-web/src/core/page-layout/chats-iframe-route.test.mjs
T
2026-07-26 17:01:09 +08:00

51 lines
1.4 KiB
JavaScript

import assert from "node:assert/strict";
import test from "node:test";
import {
isChatsIframeWorkspacePath,
resolveForcedThemeForPath,
} from "./chats-iframe-route.ts";
test("matches only workspace chats_iframe routes", () => {
assert.equal(
isChatsIframeWorkspacePath("/page/workspace/chats_iframe/new"),
true,
);
assert.equal(
isChatsIframeWorkspacePath("/page/workspace/chats_iframe/thread-123"),
true,
);
assert.equal(isChatsIframeWorkspacePath("/page/workspace/chats/new"), false);
assert.equal(isChatsIframeWorkspacePath("/landing"), false);
});
test("forces light theme for landing and chats_iframe routes only", () => {
assert.equal(resolveForcedThemeForPath("/landing"), "light");
assert.equal(
resolveForcedThemeForPath("/page/workspace/chats_iframe/new"),
"light",
);
assert.equal(
resolveForcedThemeForPath("/page/workspace/chats_iframe/thread-123"),
"light",
);
assert.equal(resolveForcedThemeForPath("/page/workspace/chats/new"), undefined);
});
test("honors the dark-blue theme query on chats_iframe routes", () => {
assert.equal(
resolveForcedThemeForPath(
"/page/workspace/chats_iframe/new",
"?from=iframe&theme=dark-blue",
),
"dark",
);
assert.equal(
resolveForcedThemeForPath(
"/page/workspace/chats_iframe/new",
"?from=iframe&theme=red",
),
"light",
);
});