mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-05 11:32:53 +00:00
Extract shared normalization/coercion helpers into private @openclaw/normalization-core workspace package while preserving existing plugin SDK helper subpaths.\n\nAlso keeps direct normalization-core imports internal, wires UI/build/loader resolution, and replaces the slow PR network CodeQL lane with a fast added-line boundary scan while retaining full CodeQL for scheduled/manual runs.\n\nVerification: local moved tests, plugin SDK boundary tests, extension loader tests, agents-support shard, UI build/test, build artifacts, lint, workflow guards, autoreview, and GitHub CI passed on PR head 963d893715.
23 lines
719 B
TypeScript
23 lines
719 B
TypeScript
import { MAX_TIMER_TIMEOUT_MS } from "@openclaw/normalization-core/number-coercion";
|
|
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
import { withTimeout } from "./with-timeout.js";
|
|
|
|
describe("node-host withTimeout", () => {
|
|
afterEach(() => {
|
|
vi.restoreAllMocks();
|
|
});
|
|
|
|
it("caps huge finite timeoutMs before scheduling the timer", async () => {
|
|
const setTimeoutSpy = vi.spyOn(globalThis, "setTimeout");
|
|
|
|
await expect(
|
|
withTimeout(async (signal) => {
|
|
expect(signal?.aborted).toBe(false);
|
|
return "ok";
|
|
}, Number.MAX_SAFE_INTEGER),
|
|
).resolves.toBe("ok");
|
|
|
|
expect(setTimeoutSpy).toHaveBeenCalledWith(expect.any(Function), MAX_TIMER_TIMEOUT_MS);
|
|
});
|
|
});
|