mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-28 05:43:35 +00:00
test(release): isolate sessions command migration tests
This commit is contained in:
@@ -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.
|
||||
*
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user