mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-24 07:31:44 +00:00
test: dedupe plugin runtime and provider suites
This commit is contained in:
@@ -2,6 +2,19 @@ import { describe, expect, it } from "vitest";
|
||||
import type { OpenClawConfig } from "../config/config.js";
|
||||
import { enablePluginInConfig } from "./enable.js";
|
||||
|
||||
function expectEnableResult(
|
||||
cfg: OpenClawConfig,
|
||||
pluginId: string,
|
||||
params: {
|
||||
enabled: boolean;
|
||||
assert: (result: ReturnType<typeof enablePluginInConfig>) => void;
|
||||
},
|
||||
) {
|
||||
const result = enablePluginInConfig(cfg, pluginId);
|
||||
expect(result.enabled).toBe(params.enabled);
|
||||
params.assert(result);
|
||||
}
|
||||
|
||||
describe("enablePluginInConfig", () => {
|
||||
it.each([
|
||||
{
|
||||
@@ -87,8 +100,9 @@ describe("enablePluginInConfig", () => {
|
||||
},
|
||||
},
|
||||
])("$name", ({ cfg, pluginId, expectedEnabled, assert }) => {
|
||||
const result = enablePluginInConfig(cfg, pluginId);
|
||||
expect(result.enabled).toBe(expectedEnabled);
|
||||
assert(result);
|
||||
expectEnableResult(cfg, pluginId, {
|
||||
enabled: expectedEnabled,
|
||||
assert,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user