mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-05 12:32:52 +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.
25 lines
929 B
TypeScript
25 lines
929 B
TypeScript
import { readFileSync } from "node:fs";
|
|
import path from "node:path";
|
|
import { describe, expect, it } from "vitest";
|
|
import { asNullableRecord, asOptionalRecord } from "./record-coerce.js";
|
|
|
|
describe("record-coerce", () => {
|
|
it("keeps record coercion behavior for optional and nullable variants", () => {
|
|
expect(asOptionalRecord({ ok: true })).toEqual({ ok: true });
|
|
expect(asOptionalRecord(null)).toBeUndefined();
|
|
expect(asOptionalRecord([{ ok: true }])).toBeUndefined();
|
|
expect(asNullableRecord({ ok: true })).toEqual({ ok: true });
|
|
expect(asNullableRecord(null)).toBeNull();
|
|
expect(asNullableRecord([{ ok: true }])).toBeNull();
|
|
});
|
|
|
|
it("stays isolated from utils.ts so browser bundles stay Node-free", () => {
|
|
const source = readFileSync(
|
|
path.resolve("packages/normalization-core/src/record-coerce.ts"),
|
|
"utf8",
|
|
);
|
|
|
|
expect(source).not.toContain("../utils.js");
|
|
});
|
|
});
|