mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-13 19:50:45 +00:00
test: tighten plugin extension array assertions
This commit is contained in:
@@ -208,7 +208,7 @@ describe("duckduckgo web search provider", () => {
|
||||
`;
|
||||
|
||||
expect(ddgClientTesting.isBotChallenge(challengeHtml)).toBe(true);
|
||||
expect(ddgClientTesting.parseDuckDuckGoHtml(challengeHtml)).toEqual([]);
|
||||
expect(ddgClientTesting.parseDuckDuckGoHtml(challengeHtml)).toStrictEqual([]);
|
||||
expect(ddgClientTesting.isBotChallenge(normalHtml)).toBe(false);
|
||||
expect(ddgClientTesting.parseDuckDuckGoHtml(normalHtml)).toEqual([
|
||||
{
|
||||
|
||||
@@ -1879,7 +1879,7 @@ describe("google-meet plugin", () => {
|
||||
);
|
||||
expect(
|
||||
result.details.checks?.filter((check) => check.id === "chrome-local-audio-device"),
|
||||
).toEqual([]);
|
||||
).toStrictEqual([]);
|
||||
expect(runCommandWithTimeout).not.toHaveBeenCalled();
|
||||
} finally {
|
||||
Object.defineProperty(process, "platform", { value: originalPlatform });
|
||||
@@ -2960,7 +2960,7 @@ describe("google-meet plugin", () => {
|
||||
});
|
||||
|
||||
expect(respond.mock.calls[0]?.[0]).toBe(true);
|
||||
expect(nodesList.mock.calls[0]).toEqual([]);
|
||||
expect(nodesList.mock.calls[0]).toStrictEqual([]);
|
||||
expect(nodesInvoke).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
nodeId: "node-1",
|
||||
|
||||
@@ -82,7 +82,7 @@ describe("google-meet config compatibility", () => {
|
||||
|
||||
const migration = normalizeCompatibilityConfig({ cfg: config });
|
||||
|
||||
expect(migration.changes).toEqual([]);
|
||||
expect(migration.changes).toStrictEqual([]);
|
||||
expect(
|
||||
(
|
||||
migration.config.plugins?.entries?.["google-meet"] as {
|
||||
|
||||
@@ -735,7 +735,7 @@ describe("lmstudio setup", () => {
|
||||
provider: "lmstudio",
|
||||
agentDir: undefined,
|
||||
});
|
||||
expect(result.profiles).toEqual([]);
|
||||
expect(result.profiles).toStrictEqual([]);
|
||||
expect(result.configPatch?.models?.providers?.lmstudio).toMatchObject({
|
||||
baseUrl: "http://localhost:1234/v1",
|
||||
api: "openai-completions",
|
||||
@@ -819,7 +819,7 @@ describe("lmstudio setup", () => {
|
||||
provider: "lmstudio",
|
||||
agentDir: undefined,
|
||||
});
|
||||
expect(result.profiles).toEqual([]);
|
||||
expect(result.profiles).toStrictEqual([]);
|
||||
expect(result.configPatch?.models?.providers?.lmstudio).toMatchObject({
|
||||
baseUrl: "http://localhost:1234/v1",
|
||||
api: "openai-completions",
|
||||
@@ -856,7 +856,7 @@ describe("lmstudio setup", () => {
|
||||
provider: "lmstudio",
|
||||
agentDir: undefined,
|
||||
});
|
||||
expect(result.profiles).toEqual([]);
|
||||
expect(result.profiles).toStrictEqual([]);
|
||||
expect(result.configPatch?.models?.providers?.lmstudio).toMatchObject({
|
||||
apiKey: LMSTUDIO_LOCAL_API_KEY_PLACEHOLDER,
|
||||
});
|
||||
|
||||
@@ -1353,7 +1353,7 @@ describe("createTelegramBot", () => {
|
||||
await runMiddlewareChain({ update: { update_id: 13_100 } }, async () => {});
|
||||
await flushTelegramTestMicrotasks();
|
||||
expect(onUpdateId).toHaveBeenCalledWith(13_100);
|
||||
expect(unhandled).toEqual([]);
|
||||
expect(unhandled).toStrictEqual([]);
|
||||
} finally {
|
||||
process.off("unhandledRejection", onUnhandledRejection);
|
||||
}
|
||||
@@ -3066,7 +3066,7 @@ describe("createTelegramBot", () => {
|
||||
|
||||
const payload = requireValue(dispatchCall?.ctx, "topic dispatch context");
|
||||
expect(payload.GroupSystemPrompt).toBe("Group prompt\n\nTopic prompt");
|
||||
expect(dispatchCall?.replyOptions?.skillFilter).toEqual([]);
|
||||
expect(dispatchCall?.replyOptions?.skillFilter).toStrictEqual([]);
|
||||
});
|
||||
it("threads native command replies inside topics", async () => {
|
||||
commandSpy.mockClear();
|
||||
|
||||
@@ -228,7 +228,7 @@ describe("plugin contract boundary invariants", () => {
|
||||
}
|
||||
return readRepoSource(file).includes("contracts/inventory/bundled-capability-metadata");
|
||||
});
|
||||
expect(offenders).toEqual([]);
|
||||
expect(offenders).toStrictEqual([]);
|
||||
});
|
||||
|
||||
it("keeps the bundled contract inventory out of non-test runtime code", () => {
|
||||
@@ -236,7 +236,7 @@ describe("plugin contract boundary invariants", () => {
|
||||
const offenders = files.filter((file) => {
|
||||
return readRepoSource(file).includes("contracts/inventory/bundled-capability-metadata");
|
||||
});
|
||||
expect(offenders).toEqual([]);
|
||||
expect(offenders).toStrictEqual([]);
|
||||
});
|
||||
|
||||
it("keeps core tests off bundled extension deep imports", () => {
|
||||
@@ -246,7 +246,7 @@ describe("plugin contract boundary invariants", () => {
|
||||
(specifier) => !isAllowedBundledExtensionImport(specifier),
|
||||
);
|
||||
});
|
||||
expect(offenders).toEqual([]);
|
||||
expect(offenders).toStrictEqual([]);
|
||||
});
|
||||
|
||||
it("keeps plugin contract tests off bundled path helpers unless the test is explicitly about paths", () => {
|
||||
@@ -263,7 +263,7 @@ describe("plugin contract boundary invariants", () => {
|
||||
)
|
||||
);
|
||||
});
|
||||
expect(offenders).toEqual([]);
|
||||
expect(offenders).toStrictEqual([]);
|
||||
});
|
||||
|
||||
it("keeps channel production code off bundled-plugin-metadata helpers", () => {
|
||||
@@ -271,7 +271,7 @@ describe("plugin contract boundary invariants", () => {
|
||||
const offenders = files.filter((file) => {
|
||||
return readRepoSource(file).includes("plugins/bundled-plugin-metadata");
|
||||
});
|
||||
expect(offenders).toEqual([]);
|
||||
expect(offenders).toStrictEqual([]);
|
||||
});
|
||||
|
||||
it("keeps contract loaders off hand-built bundled extension paths", () => {
|
||||
@@ -283,13 +283,13 @@ describe("plugin contract boundary invariants", () => {
|
||||
const source = readRepoSource(file);
|
||||
return /extensions\/\$\{|\.\.\/\.\.\/\.\.\/\.\.\/extensions\//u.test(source);
|
||||
});
|
||||
expect(offenders).toEqual([]);
|
||||
expect(offenders).toStrictEqual([]);
|
||||
});
|
||||
|
||||
it("keeps bundled plugin production code off legacy before_agent_start hooks", () => {
|
||||
const files = listTsFiles("extensions", { excludeTests: true });
|
||||
const offenders = files.filter((file) => readRepoSource(file).includes("before_agent_start"));
|
||||
expect(offenders).toEqual([]);
|
||||
expect(offenders).toStrictEqual([]);
|
||||
});
|
||||
|
||||
it("keeps bundled plugin typed hook registrations on an explicit allowlist", () => {
|
||||
@@ -312,7 +312,7 @@ describe("plugin contract boundary invariants", () => {
|
||||
it("keeps bundled plugin production code off raw registerHook calls", () => {
|
||||
const files = listTsFiles("extensions", { excludeTests: true });
|
||||
const offenders = files.filter((file) => /\bregisterHook\(/u.test(readRepoSource(file)));
|
||||
expect(offenders).toEqual([]);
|
||||
expect(offenders).toStrictEqual([]);
|
||||
});
|
||||
|
||||
it("keeps long-lived bundled hook handlers on live runtime config lookups", () => {
|
||||
@@ -324,7 +324,7 @@ describe("plugin contract boundary invariants", () => {
|
||||
.map((snippet) => `${file}: ${snippet}`);
|
||||
},
|
||||
);
|
||||
expect(missingGuards).toEqual([]);
|
||||
expect(missingGuards).toStrictEqual([]);
|
||||
});
|
||||
|
||||
it("keeps live provider config surfaces on runtime config lookups", () => {
|
||||
@@ -336,7 +336,7 @@ describe("plugin contract boundary invariants", () => {
|
||||
.map((snippet) => `${file}: ${snippet}`);
|
||||
},
|
||||
);
|
||||
expect(missingGuards).toEqual([]);
|
||||
expect(missingGuards).toStrictEqual([]);
|
||||
});
|
||||
|
||||
it("keeps long-lived bundled hook handlers off startup-only registration gates", () => {
|
||||
@@ -348,6 +348,6 @@ describe("plugin contract boundary invariants", () => {
|
||||
.map((snippet) => `${file}: ${snippet}`);
|
||||
},
|
||||
);
|
||||
expect(offenders).toEqual([]);
|
||||
expect(offenders).toStrictEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -125,6 +125,6 @@ describe("config boundary guard", () => {
|
||||
].join("\n"),
|
||||
);
|
||||
|
||||
expect(collectDeprecatedInternalConfigApiViolations({ repoRoot })).toEqual([]);
|
||||
expect(collectDeprecatedInternalConfigApiViolations({ repoRoot })).toStrictEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -262,6 +262,6 @@ describe("opt-in extension package boundaries", () => {
|
||||
});
|
||||
|
||||
it("keeps plugin-package-contract independent from core internals", () => {
|
||||
expect(collectCoreReferenceFiles("packages/plugin-package-contract/src")).toEqual([]);
|
||||
expect(collectCoreReferenceFiles("packages/plugin-package-contract/src")).toStrictEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -771,7 +771,7 @@ describe("installPluginFromArchive", () => {
|
||||
});
|
||||
|
||||
expect(result.ok).toBe(true);
|
||||
expect(warnings).toEqual([]);
|
||||
expect(warnings).toStrictEqual([]);
|
||||
});
|
||||
|
||||
it("installs flat-root plugin archives from ClawHub-style downloads", async () => {
|
||||
@@ -1992,7 +1992,7 @@ describe("installPluginFromArchive", () => {
|
||||
});
|
||||
|
||||
expect(result.ok).toBe(true);
|
||||
expect(warnings).toEqual([]);
|
||||
expect(warnings).toStrictEqual([]);
|
||||
});
|
||||
|
||||
it("does not flag the real qa-matrix plugin as dangerous install code", async () => {
|
||||
@@ -2636,7 +2636,7 @@ describe("installPluginFromArchive", () => {
|
||||
expect(result.code).toBe(PLUGIN_INSTALL_ERROR_CODE.SECURITY_SCAN_FAILED);
|
||||
expect(result.error).toContain("code safety scan failed (Error: scanner exploded)");
|
||||
}
|
||||
expect(warnings).toEqual([]);
|
||||
expect(warnings).toStrictEqual([]);
|
||||
scanSpy.mockRestore();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user