mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-17 19:41:35 +00:00
* feat(tooling): add noUncheckedIndexedAccess strict-ratchet lane * fix(packages): make indexed access explicit across ratchet packages Burns down all 65 noUncheckedIndexedAccess errors in the seven ratchet packages with behavior-identical restructuring (iteration, charAt/slice, regex-group guards, validated hextet tuple). net-policy invariant violations now throw instead of failing open. Adds @openclaw/normalization-core/expect (expectDefined/first/last) with subpath export and tests. memory-host-sdk fixes kept but the package stays out of the lane: it re-exports core src/** so the flag would apply transitively to all of core. * fix(lint): keep .oxlintrc.json strict-JSON parseable for extension lint wrappers
20 lines
644 B
TypeScript
20 lines
644 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { expectDefined, first, last } from "./expect.js";
|
|
|
|
describe("expect helpers", () => {
|
|
it("returns defined values", () => {
|
|
expect(expectDefined(0, "number")).toBe(0);
|
|
});
|
|
|
|
it.each([null, undefined])("rejects missing values", (value) => {
|
|
expect(() => expectDefined(value, "test value")).toThrow("expected test value to be defined");
|
|
});
|
|
|
|
it("reads array boundaries without claiming they exist", () => {
|
|
expect(first(["a", "b"])).toBe("a");
|
|
expect(last(["a", "b"])).toBe("b");
|
|
expect(first([])).toBeUndefined();
|
|
expect(last([])).toBeUndefined();
|
|
});
|
|
});
|