mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-25 04:28:38 +00:00
* fix(config): accept $schema key in root config (#14998) * fix: strip $schema via preprocess to avoid spurious UI section * fix(config): allow root without zod preprocess wrapper --------- Co-authored-by: Peter Steinberger <steipete@gmail.com>
25 lines
755 B
TypeScript
25 lines
755 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { OpenClawSchema } from "./zod-schema.js";
|
|
|
|
describe("$schema key in config (#14998)", () => {
|
|
it("accepts config with $schema string", () => {
|
|
const result = OpenClawSchema.safeParse({
|
|
$schema: "https://openclaw.ai/config.json",
|
|
});
|
|
expect(result.success).toBe(true);
|
|
if (result.success) {
|
|
expect(result.data.$schema).toBe("https://openclaw.ai/config.json");
|
|
}
|
|
});
|
|
|
|
it("accepts config without $schema", () => {
|
|
const result = OpenClawSchema.safeParse({});
|
|
expect(result.success).toBe(true);
|
|
});
|
|
|
|
it("rejects non-string $schema", () => {
|
|
const result = OpenClawSchema.safeParse({ $schema: 123 });
|
|
expect(result.success).toBe(false);
|
|
});
|
|
});
|