
























@@ -28,6 +28,16 @@ function makeTempDir() {
28282929const mkdirSafe = mkdirSafeDir;
303031+function countMatching<T>(items: readonly T[], predicate: (item: T) => boolean): number {
32+let count = 0;
33+for (const item of items) {
34+if (predicate(item)) {
35+count += 1;
36+}
37+}
38+return count;
39+}
40+3141function withOpenClawPackageArgv<T>(packageRoot: string, fn: () => T): T {
3242mkdirSafe(path.join(packageRoot, "bin"));
3343fs.writeFileSync(path.join(packageRoot, "package.json"), '{"name":"openclaw"}\n', "utf-8");
@@ -591,9 +601,10 @@ describe("discoverOpenClawPlugins", () => {
591601}),
592602);
593603594-expect(candidates.filter((candidate) => candidate.idHint === "feishu")).toEqual([
604+expect(candidates.find((candidate) => candidate.idHint === "feishu")).toEqual(
595605expect.objectContaining({ origin: "bundled" }),
596-]);
606+);
607+expect(countMatching(candidates, (candidate) => candidate.idHint === "feishu")).toBe(1);
597608expect(diagnostics).toEqual([
598609expect.objectContaining({
599610level: "warn",
@@ -628,9 +639,10 @@ describe("discoverOpenClawPlugins", () => {
628639}),
629640);
630641631-expect(candidates.filter((candidate) => candidate.idHint === "telegram")).toEqual([
642+expect(candidates.find((candidate) => candidate.idHint === "telegram")).toEqual(
632643expect.objectContaining({ origin: "bundled" }),
633-]);
644+);
645+expect(countMatching(candidates, (candidate) => candidate.idHint === "telegram")).toBe(1);
634646expect(diagnostics).toEqual([
635647expect.objectContaining({
636648level: "warn",
@@ -725,13 +737,14 @@ describe("discoverOpenClawPlugins", () => {
725737}),
726738);
727739728-expect(candidates.filter((candidate) => candidate.idHint === "synology-chat")).toEqual([
740+expect(candidates.find((candidate) => candidate.idHint === "synology-chat")).toEqual(
729741expect.objectContaining({
730742origin: "bundled",
731743rootDir: fs.realpathSync(bundledPluginDir),
732744source: fs.realpathSync(bundledEntryPath),
733745}),
734-]);
746+);
747+expect(countMatching(candidates, (candidate) => candidate.idHint === "synology-chat")).toBe(1);
735748expect(diagnostics).toEqual([]);
736749});
737750此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。