mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 07:00:43 +00:00
perf(test): reuse plugin validation fixtures
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import fs from "node:fs/promises";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
import { afterAll, afterEach, beforeAll, describe, expect, it, vi } from "vitest";
|
||||
import { afterAll, beforeAll, describe, expect, it, vi } from "vitest";
|
||||
import { clearPluginManifestRegistryCache } from "../plugins/manifest-registry.js";
|
||||
import { validateConfigObjectWithPlugins } from "./validation.js";
|
||||
|
||||
@@ -109,7 +109,6 @@ describe("config plugin validation", () => {
|
||||
OPENCLAW_HOME: undefined,
|
||||
OPENCLAW_STATE_DIR: path.join(suiteHome, ".openclaw"),
|
||||
OPENCLAW_PLUGIN_MANIFEST_CACHE_MS: "10000",
|
||||
OPENCLAW_DISABLE_PLUGIN_DISCOVERY_CACHE: "1",
|
||||
OPENCLAW_BUNDLED_PLUGINS_DIR: undefined,
|
||||
OPENCLAW_VERSION: undefined,
|
||||
VITEST: "true",
|
||||
@@ -228,11 +227,6 @@ describe("config plugin validation", () => {
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
vi.restoreAllMocks();
|
||||
clearPluginManifestRegistryCache();
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await fs.rm(fixtureRoot, { recursive: true, force: true });
|
||||
clearPluginManifestRegistryCache();
|
||||
|
||||
@@ -365,7 +365,7 @@ describe("applyPluginAutoEnable core", () => {
|
||||
});
|
||||
|
||||
it("preserves configured plugin entries in restrictive plugins.allow", () => {
|
||||
const result = applyPluginAutoEnable({
|
||||
const result = materializePluginAutoEnableCandidates({
|
||||
config: {
|
||||
plugins: {
|
||||
allow: ["glueclaw"],
|
||||
@@ -378,7 +378,9 @@ describe("applyPluginAutoEnable core", () => {
|
||||
},
|
||||
},
|
||||
},
|
||||
candidates: [],
|
||||
env,
|
||||
manifestRegistry: makeRegistry([{ id: "discord", channels: [] }]),
|
||||
});
|
||||
|
||||
expect(result.config.plugins?.allow).toEqual(["glueclaw", "discord"]);
|
||||
@@ -386,7 +388,7 @@ describe("applyPluginAutoEnable core", () => {
|
||||
});
|
||||
|
||||
it("does not preserve stale configured plugin entries in restrictive plugins.allow", () => {
|
||||
const result = applyPluginAutoEnable({
|
||||
const result = materializePluginAutoEnableCandidates({
|
||||
config: {
|
||||
plugins: {
|
||||
allow: ["glueclaw"],
|
||||
@@ -399,7 +401,9 @@ describe("applyPluginAutoEnable core", () => {
|
||||
},
|
||||
},
|
||||
},
|
||||
candidates: [],
|
||||
env,
|
||||
manifestRegistry: makeRegistry([]),
|
||||
});
|
||||
|
||||
expect(result.config.plugins?.allow).toEqual(["glueclaw"]);
|
||||
|
||||
Reference in New Issue
Block a user