mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-23 10:55:31 -06:00
f0379468ff
* fix(config): materialize snapshot mode with the same defaults as load * test(config): prove snapshot-injected defaults stay out of persisted config * test(cli): keep unknown-command process test hermetic --------- Co-authored-by: Kevin Lin <kevin@dendron.so>
41 lines
1.3 KiB
TypeScript
41 lines
1.3 KiB
TypeScript
// Verifies snapshot/load materialization parity for prepared-runtime config matching.
|
|
import { describe, expect, it } from "vitest";
|
|
import { materializeRuntimeConfig } from "./materialize.js";
|
|
import type { OpenClawConfig } from "./types.openclaw.js";
|
|
|
|
describe("materializeRuntimeConfig", () => {
|
|
it("materializes snapshot and load identically when defaults must be injected", () => {
|
|
// A compaction block without a mode is the shape that forces default injection.
|
|
const config: OpenClawConfig = {
|
|
agents: {
|
|
defaults: {
|
|
compaction: {},
|
|
},
|
|
},
|
|
};
|
|
|
|
const snapshot = materializeRuntimeConfig(config, "snapshot");
|
|
const load = materializeRuntimeConfig(config, "load");
|
|
|
|
expect(snapshot.agents?.defaults?.compaction?.mode).toBeDefined();
|
|
expect(snapshot).toEqual(load);
|
|
});
|
|
|
|
it("keeps an explicit compaction mode unchanged in both modes", () => {
|
|
const config: OpenClawConfig = {
|
|
agents: {
|
|
defaults: {
|
|
compaction: { mode: "safeguard" },
|
|
},
|
|
},
|
|
};
|
|
|
|
expect(materializeRuntimeConfig(config, "snapshot").agents?.defaults?.compaction?.mode).toBe(
|
|
"safeguard",
|
|
);
|
|
expect(materializeRuntimeConfig(config, "load").agents?.defaults?.compaction?.mode).toBe(
|
|
"safeguard",
|
|
);
|
|
});
|
|
});
|