test(release): isolate sessions command migration tests

This commit is contained in:
Vincent Koc
2026-06-08 15:57:18 +02:00
parent 37c1e2725a
commit 95c72dde0f
2 changed files with 13 additions and 13 deletions

View File

@@ -2,7 +2,7 @@
import fs from "node:fs";
import os from "node:os";
import path from "node:path";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { afterEach, beforeEach, describe, expect, it } from "vitest";
import { writeAcpSessionMetaForMigration } from "../acp/runtime/session-meta.js";
import type { SessionEntry } from "../config/sessions/types.js";
import { closeOpenClawStateDatabaseForTest } from "../state/openclaw-state-db.js";
@@ -14,18 +14,6 @@ import {
writeStore,
} from "./sessions.test-helpers.js";
vi.mock("../infra/state-migrations.js", async () => ({
...(await vi.importActual<typeof import("../infra/state-migrations.js")>(
"../infra/state-migrations.js",
)),
autoMigrateLegacyState: vi.fn(async () => ({
migrated: false,
skipped: true,
changes: [],
warnings: [],
})),
}));
/**
* Catalog #20 — `model` / `modelProvider` reported as agent-config, not ACP runtime actuals.
*

View File

@@ -25,6 +25,18 @@ vi.mock("../config/config.js", () => ({
loadConfig: () => sessionsConfigState.loadConfig(),
}));
vi.mock("../infra/state-migrations.js", async () => ({
...(await vi.importActual<typeof import("../infra/state-migrations.js")>(
"../infra/state-migrations.js",
)),
autoMigrateLegacyState: vi.fn(async () => ({
migrated: false,
skipped: true,
changes: [],
warnings: [],
})),
}));
export function mockSessionsConfig() {
// The shared config mock is hoisted above so tests can keep their
// existing setup call without paying `importActual` cost or nested-mock