From f810cc4d5820d17f56269f89209bfcfef58a993b Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Fri, 17 Apr 2026 08:13:41 +0100 Subject: [PATCH] test: lower matrix bind coverage boundary --- .../agents.bind.matrix.integration.test.ts | 43 +++++-------------- 1 file changed, 10 insertions(+), 33 deletions(-) diff --git a/src/commands/agents.bind.matrix.integration.test.ts b/src/commands/agents.bind.matrix.integration.test.ts index bdf976bd351..d969c29c7a1 100644 --- a/src/commands/agents.bind.matrix.integration.test.ts +++ b/src/commands/agents.bind.matrix.integration.test.ts @@ -1,17 +1,10 @@ -import { afterEach, beforeEach, describe, expect, it } from "vitest"; +import { afterEach, describe, expect, it } from "vitest"; import { setActivePluginRegistry } from "../plugins/runtime.js"; import { createBindingResolverTestPlugin, createTestRegistry, } from "../test-utils/channel-plugins.js"; -import { - loadFreshAgentsBindCommandModuleForTest, - readConfigFileSnapshotMock, - resetAgentsBindTestHarness, - runtime, - writeConfigFileMock, -} from "./agents.bind.test-support.js"; -import { baseConfigSnapshot } from "./test-runtime-config-helpers.js"; +import { parseBindingSpecs } from "./agents.bindings.js"; const matrixBindingPlugin = createBindingResolverTestPlugin({ id: "matrix", @@ -25,37 +18,21 @@ const matrixBindingPlugin = createBindingResolverTestPlugin({ }, }); -let agentsBindCommand: typeof import("./agents.commands.bind.js").agentsBindCommand; - describe("agents bind matrix integration", () => { - beforeEach(async () => { - ({ agentsBindCommand } = await loadFreshAgentsBindCommandModuleForTest()); - resetAgentsBindTestHarness(); - + it("uses matrix plugin binding resolver when accountId is omitted", () => { setActivePluginRegistry( createTestRegistry([{ pluginId: "matrix", plugin: matrixBindingPlugin, source: "test" }]), ); + + const parsed = parseBindingSpecs({ agentId: "main", specs: ["matrix"], config: {} }); + + expect(parsed.errors).toEqual([]); + expect(parsed.bindings).toEqual([ + { type: "route", agentId: "main", match: { channel: "matrix", accountId: "main" } }, + ]); }); afterEach(() => { setActivePluginRegistry(createTestRegistry()); }); - - it("uses matrix plugin binding resolver when accountId is omitted", async () => { - readConfigFileSnapshotMock.mockResolvedValue({ - ...baseConfigSnapshot, - config: {}, - }); - - await agentsBindCommand({ agent: "main", bind: ["matrix"] }, runtime); - - expect(writeConfigFileMock).toHaveBeenCalledWith( - expect.objectContaining({ - bindings: [ - { type: "route", agentId: "main", match: { channel: "matrix", accountId: "main" } }, - ], - }), - ); - expect(runtime.exit).not.toHaveBeenCalled(); - }); });