fix(test): repair readonly case table typing

This commit is contained in:
Peter Steinberger
2026-02-22 00:09:06 +01:00
parent 8394f0e30e
commit 843a037532
4 changed files with 45 additions and 12 deletions

View File

@@ -12,6 +12,7 @@ import type { OpenClawConfig } from "../../config/config.js";
import { updateSessionStore } from "../../config/sessions.js";
import * as internalHooks from "../../hooks/internal-hooks.js";
import { clearPluginCommands, registerPluginCommand } from "../../plugins/commands.js";
import { typedCases } from "../../test-utils/typed-cases.js";
import type { MsgContext } from "../templating.js";
import { resetBashChatCommandForTests } from "./bash-command.js";
import { handleCompactCommand } from "./commands-compact.js";
@@ -138,7 +139,12 @@ function buildParams(commandBody: string, cfg: OpenClawConfig, ctxOverrides?: Pa
describe("handleCommands gating", () => {
it("blocks /bash when disabled or not elevated-allowlisted", async () => {
resetBashChatCommandForTests();
const cases = [
const cases = typedCases<{
name: string;
cfg: OpenClawConfig;
applyParams?: (params: ReturnType<typeof buildParams>) => void;
expectedText: string;
}>([
{
name: "disabled bash command",
cfg: {
@@ -162,7 +168,7 @@ describe("handleCommands gating", () => {
},
expectedText: "elevated is not available",
},
] as const;
]);
for (const testCase of cases) {
const params = buildParams("/bash echo hi", testCase.cfg);
testCase.applyParams?.(params);