mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-01 22:40:20 +00:00
fix(plugins): address review feedback for Matrix recovery paths (#52899)
This commit is contained in:
committed by
Peter Steinberger
parent
489797ceaf
commit
cbb11b3662
@@ -4,6 +4,7 @@ import type { OpenClawConfig } from "../config/config.js";
|
||||
import { createCliRuntimeCapture } from "./test-runtime-capture.js";
|
||||
|
||||
export const loadConfig = vi.fn<() => OpenClawConfig>(() => ({}) as OpenClawConfig);
|
||||
export const readConfigFileSnapshot = vi.fn();
|
||||
export const writeConfigFile = vi.fn<(config: OpenClawConfig) => Promise<void>>(
|
||||
async () => undefined,
|
||||
);
|
||||
@@ -39,6 +40,7 @@ vi.mock("../runtime.js", () => ({
|
||||
|
||||
vi.mock("../config/config.js", () => ({
|
||||
loadConfig: () => loadConfig(),
|
||||
readConfigFileSnapshot: (...args: unknown[]) => readConfigFileSnapshot(...args),
|
||||
writeConfigFile: (config: OpenClawConfig) => writeConfigFile(config),
|
||||
}));
|
||||
|
||||
@@ -138,6 +140,7 @@ export function runPluginsCommand(argv: string[]) {
|
||||
export function resetPluginsCliTestState() {
|
||||
resetRuntimeCapture();
|
||||
loadConfig.mockReset();
|
||||
readConfigFileSnapshot.mockReset();
|
||||
writeConfigFile.mockReset();
|
||||
resolveStateDir.mockReset();
|
||||
installPluginFromMarketplace.mockReset();
|
||||
@@ -161,6 +164,19 @@ export function resetPluginsCliTestState() {
|
||||
recordHookInstall.mockReset();
|
||||
|
||||
loadConfig.mockReturnValue({} as OpenClawConfig);
|
||||
readConfigFileSnapshot.mockResolvedValue({
|
||||
path: "/tmp/openclaw-config.json5",
|
||||
exists: true,
|
||||
raw: "{}",
|
||||
parsed: {},
|
||||
resolved: {},
|
||||
valid: true,
|
||||
config: {} as OpenClawConfig,
|
||||
hash: "mock",
|
||||
issues: [],
|
||||
warnings: [],
|
||||
legacyIssues: [],
|
||||
});
|
||||
writeConfigFile.mockResolvedValue(undefined);
|
||||
resolveStateDir.mockReturnValue("/tmp/openclaw-state");
|
||||
resolveMarketplaceInstallShortcut.mockResolvedValue(null);
|
||||
|
||||
Reference in New Issue
Block a user