test: fix gate regressions

This commit is contained in:
Peter Steinberger
2026-02-24 04:39:29 +00:00
parent 2d6d6797d8
commit 31f2bf9519
6 changed files with 53 additions and 41 deletions

View File

@@ -112,7 +112,7 @@ async function runReasoningDefaultCase(params: {
describe("directive behavior", () => {
installDirectiveBehaviorE2EHooks();
it("shows /think defaults for reasoning and non-reasoning models", async () => {
it("covers /think status and reasoning defaults for reasoning and non-reasoning models", async () => {
await withTempHome(async (home) => {
await expectThinkStatusForReasoningModel({
home,
@@ -125,6 +125,25 @@ describe("directive behavior", () => {
expectedLevel: "off",
});
expect(runEmbeddedPiAgent).not.toHaveBeenCalled();
vi.mocked(runEmbeddedPiAgent).mockClear();
for (const scenario of [
{
expectedThinkLevel: "low" as const,
expectedReasoningLevel: "off" as const,
},
{
expectedThinkLevel: "off" as const,
expectedReasoningLevel: "on" as const,
thinkingDefault: "off" as const,
},
]) {
await runReasoningDefaultCase({
home,
...scenario,
});
}
});
});
it("renders model list and status variants across catalog/config combinations", async () => {
@@ -282,26 +301,6 @@ describe("directive behavior", () => {
expect(runEmbeddedPiAgent).toHaveBeenCalledOnce();
});
});
it("applies reasoning defaults based on thinkingDefault configuration", async () => {
await withTempHome(async (home) => {
for (const scenario of [
{
expectedThinkLevel: "low" as const,
expectedReasoningLevel: "off" as const,
},
{
expectedThinkLevel: "off" as const,
expectedReasoningLevel: "on" as const,
thinkingDefault: "off" as const,
},
]) {
await runReasoningDefaultCase({
home,
...scenario,
});
}
});
});
it("passes elevated defaults when sender is approved", async () => {
await withTempHome(async (home) => {
mockEmbeddedTextResult("done");

View File

@@ -64,14 +64,16 @@ describe("browser control server", () => {
});
expect(nav.ok).toBe(true);
expect(typeof nav.targetId).toBe("string");
expect(pwMocks.navigateViaPlaywright).toHaveBeenCalledWith({
cdpUrl: state.cdpBaseUrl,
targetId: "abcd1234",
url: "https://example.com",
ssrfPolicy: {
dangerouslyAllowPrivateNetwork: true,
},
});
expect(pwMocks.navigateViaPlaywright).toHaveBeenCalledWith(
expect.objectContaining({
cdpUrl: state.cdpBaseUrl,
targetId: "abcd1234",
url: "https://example.com",
ssrfPolicy: {
dangerouslyAllowPrivateNetwork: true,
},
}),
);
const click = await postJson<{ ok: boolean }>(`${base}/act`, {
kind: "click",

View File

@@ -636,14 +636,6 @@ describe("update-cli", () => {
}
});
it("updateCommand skips restart when --no-restart is set", async () => {
vi.mocked(runGatewayUpdate).mockResolvedValue(makeOkUpdateResult());
await updateCommand({ restart: false });
expect(runDaemonRestart).not.toHaveBeenCalled();
});
it("updateCommand skips success message when restart does not run", async () => {
vi.mocked(runGatewayUpdate).mockResolvedValue(makeOkUpdateResult());
vi.mocked(runDaemonRestart).mockResolvedValue(false);

View File

@@ -134,7 +134,7 @@ describe("config io write", () => {
logger: silentLogger,
});
const invalidConfig = {
const invalidConfig: OpenClawConfig = {
channels: {
telegram: {
dmPolicy: "open",

View File

@@ -105,12 +105,12 @@ describe("runCommandWithTimeout", () => {
"clearInterval(ticker);",
"process.exit(0);",
"}",
"}, 40);",
"}, 12);",
].join(" "),
],
{
timeoutMs: 5_000,
noOutputTimeoutMs: 1_500,
noOutputTimeoutMs: 120,
},
);