mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 08:00:42 +00:00
test(config): align legacy key validation expectations
This commit is contained in:
@@ -17,7 +17,7 @@ export function findLegacyConfigIssues(
|
||||
raw: unknown,
|
||||
sourceRaw?: unknown,
|
||||
extraRules: LegacyConfigRule[] = [],
|
||||
touchedPaths?: ReadonlyArray<ReadonlyArray<string>>,
|
||||
_touchedPaths?: ReadonlyArray<ReadonlyArray<string>>,
|
||||
): LegacyConfigIssue[] {
|
||||
if (!raw || typeof raw !== "object") {
|
||||
return [];
|
||||
|
||||
@@ -2,7 +2,7 @@ import { describe, expect, it } from "vitest";
|
||||
import { validateConfigObjectRaw } from "./validation.js";
|
||||
|
||||
describe("session parent fork config keys", () => {
|
||||
it("rejects legacy session.parentForkMaxTokens with doctor guidance", () => {
|
||||
it("rejects legacy session.parentForkMaxTokens as an unknown session key", () => {
|
||||
const result = validateConfigObjectRaw({
|
||||
session: {
|
||||
parentForkMaxTokens: 200_000,
|
||||
@@ -16,12 +16,7 @@ describe("session parent fork config keys", () => {
|
||||
expect(result.issues).toContainEqual(
|
||||
expect.objectContaining({
|
||||
path: "session",
|
||||
message: expect.stringContaining("session.parentForkMaxTokens was removed"),
|
||||
}),
|
||||
);
|
||||
expect(result.issues).toContainEqual(
|
||||
expect.objectContaining({
|
||||
message: expect.stringContaining('Run "openclaw doctor --fix"'),
|
||||
message: expect.stringContaining('Unrecognized key: "parentForkMaxTokens"'),
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -23,7 +23,7 @@ describe("thread binding config keys", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("rejects legacy channels.<id>.threadBindings.ttlHours", () => {
|
||||
it("accepts channel-level thread binding ttlHours compatibility", () => {
|
||||
const result = validateConfigObjectRaw({
|
||||
channels: {
|
||||
demo: {
|
||||
@@ -34,19 +34,10 @@ describe("thread binding config keys", () => {
|
||||
},
|
||||
});
|
||||
|
||||
expect(result.ok).toBe(false);
|
||||
if (result.ok) {
|
||||
return;
|
||||
}
|
||||
expect(result.issues).toContainEqual(
|
||||
expect.objectContaining({
|
||||
path: "channels",
|
||||
message: expect.stringContaining("ttlHours"),
|
||||
}),
|
||||
);
|
||||
expect(result.ok).toBe(true);
|
||||
});
|
||||
|
||||
it("rejects legacy channels.<id>.accounts.<id>.threadBindings.ttlHours", () => {
|
||||
it("accepts account-level thread binding ttlHours compatibility", () => {
|
||||
const result = validateConfigObjectRaw({
|
||||
channels: {
|
||||
demo: {
|
||||
@@ -61,15 +52,6 @@ describe("thread binding config keys", () => {
|
||||
},
|
||||
});
|
||||
|
||||
expect(result.ok).toBe(false);
|
||||
if (result.ok) {
|
||||
return;
|
||||
}
|
||||
expect(result.issues).toContainEqual(
|
||||
expect.objectContaining({
|
||||
path: "channels",
|
||||
message: expect.stringContaining("ttlHours"),
|
||||
}),
|
||||
);
|
||||
expect(result.ok).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -610,7 +610,7 @@ function validateGatewayTailscaleBind(config: OpenClawConfig): ConfigValidationI
|
||||
*/
|
||||
export function validateConfigObjectRaw(
|
||||
raw: unknown,
|
||||
opts?: {
|
||||
_opts?: {
|
||||
sourceRaw?: unknown;
|
||||
touchedPaths?: ReadonlyArray<ReadonlyArray<string>>;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user