fix(runtime): 运行稳定性 - 修复技能种子、任务续租与回归检查
保留社区技能作者与时间戳修复、Agent 参数约束、资源删除 worker 生命周期、PostgreSQL/Redis 测试门禁及相关回归。 Original-Commit: 0d05ff88bbe6c875d01964041788023a662ff7e8
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { readFileSync } from "node:fs";
|
||||
import { renderToStaticMarkup } from "react-dom/server";
|
||||
|
||||
import { FloatingDock } from "../src/components/ui/aceternity/floating-dock";
|
||||
|
||||
// 指针能力探测是纯增强:`window` 存在不代表 `matchMedia` 存在(SSR 垫片、嵌入式 webview、
|
||||
// 部分 DOM polyfill 下它是 undefined),而 FloatingDock 在**渲染期**就取
|
||||
@@ -15,4 +18,17 @@ describe("floating dock pointer capability probe", () => {
|
||||
expect(source).not.toMatch(/window\.matchMedia\("\(pointer: coarse\)"\)\.matches/);
|
||||
expect(source).not.toMatch(/const media = window\.matchMedia/);
|
||||
});
|
||||
|
||||
test("renders the real dock with a window shim lacking matchMedia", () => {
|
||||
const original = Object.getOwnPropertyDescriptor(globalThis, "window");
|
||||
try {
|
||||
Object.defineProperty(globalThis, "window", { configurable: true, value: new EventTarget() });
|
||||
const markup = renderToStaticMarkup(<FloatingDock items={[{ id: "probe", label: "操作", icon: <span>+</span> }]} />);
|
||||
expect(markup).toContain("操作");
|
||||
expect(markup).toContain("button");
|
||||
} finally {
|
||||
if (original) Object.defineProperty(globalThis, "window", original);
|
||||
else Reflect.deleteProperty(globalThis, "window");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user