Tests: stabilize merged CI fixtures

This commit is contained in:
Ruslan Belkin 2026-03-19 17:55:40 -07:00
parent 60c70f0dfc
commit 77b51a768a
3 changed files with 20 additions and 1 deletions

View File

@ -1,5 +1,5 @@
import "./isolated-agent.mocks.js";
import { beforeEach, describe, expect, it, vi } from "vitest";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { loadModelCatalog } from "../agents/model-catalog.js";
import * as modelSelection from "../agents/model-selection.js";
import { runEmbeddedPiAgent } from "../agents/pi-embedded.js";
@ -11,6 +11,7 @@ import {
withTempCronHome,
writeSessionStoreEntries,
} from "./isolated-agent.test-harness.js";
import { setupIsolatedAgentTurnMocks } from "./isolated-agent.test-setup.js";
import type { CronJob } from "./types.js";
const withTempHome = withTempCronHome;
@ -126,11 +127,16 @@ async function expectInvalidModel(home: string, model: string) {
describe("cron model formatting and precedence edge cases", () => {
beforeEach(() => {
setupIsolatedAgentTurnMocks({ fast: true });
vi.spyOn(modelSelection, "resolveThinkingDefault").mockReturnValue("off");
vi.mocked(runEmbeddedPiAgent).mockClear();
vi.mocked(loadModelCatalog).mockResolvedValue([]);
});
afterEach(() => {
vi.unstubAllEnvs();
});
// ------ provider/model string splitting ------
describe("parseModelRef formatting", () => {

View File

@ -289,6 +289,7 @@ describe("secrets runtime snapshot integration", () => {
plugins: {
entries: {
google: {
enabled: true,
config: {
webSearch: {
apiKey: {

View File

@ -30,6 +30,11 @@ describe("git-hooks/pre-commit (integration)", () => {
path.join(process.cwd(), "git-hooks", "pre-commit"),
path.join(dir, "git-hooks", "pre-commit"),
);
writeFileSync(
path.join(dir, "package.json"),
`${JSON.stringify({ name: "openclaw-pre-commit-test", private: true }, null, 2)}\n`,
"utf8",
);
writeFileSync(
path.join(dir, "scripts", "pre-commit", "run-node-tool.sh"),
"#!/usr/bin/env bash\nexit 0\n",
@ -49,6 +54,13 @@ describe("git-hooks/pre-commit (integration)", () => {
encoding: "utf8",
mode: 0o755,
});
writeFileSync(path.join(fakeBinDir, "pnpm"), "#!/usr/bin/env bash\nexit 0\n", {
encoding: "utf8",
mode: 0o755,
});
writeFileSync(path.join(fakeBinDir, "pnpm.cmd"), "@echo off\r\nexit /b 0\r\n", {
encoding: "utf8",
});
// Create an untracked file that should NOT be staged by the hook.
writeFileSync(path.join(dir, "secret.txt"), "do-not-stage\n", "utf8");