diff --git a/v2/src/lib/adapters/btmsg-bridge.test.ts b/v2/src/lib/adapters/btmsg-bridge.test.ts index 72c7ba7..2905622 100644 --- a/v2/src/lib/adapters/btmsg-bridge.test.ts +++ b/v2/src/lib/adapters/btmsg-bridge.test.ts @@ -23,6 +23,7 @@ import { sendChannelMessage, createChannel, addChannelMember, + registerAgents, type BtmsgAgent, type BtmsgMessage, type BtmsgFeedMessage, @@ -228,6 +229,17 @@ describe('btmsg-bridge', () => { await addChannelMember('ch1', AgentId('a1')); expect(mockInvoke).toHaveBeenCalledWith('btmsg_add_channel_member', { channelId: 'ch1', agentId: 'a1' }); }); + + it('registerAgents invokes btmsg_register_agents with groups config', async () => { + mockInvoke.mockResolvedValue(undefined); + const config = { + version: 1, + groups: [{ id: 'g1', name: 'Test', projects: [], agents: [] }], + activeGroupId: 'g1', + }; + await registerAgents(config as any); + expect(mockInvoke).toHaveBeenCalledWith('btmsg_register_agents', { config }); + }); }); describe('error propagation', () => { diff --git a/v2/src/lib/adapters/bttask-bridge.test.ts b/v2/src/lib/adapters/bttask-bridge.test.ts index 9003ad6..92ee745 100644 --- a/v2/src/lib/adapters/bttask-bridge.test.ts +++ b/v2/src/lib/adapters/bttask-bridge.test.ts @@ -95,10 +95,11 @@ describe('bttask-bridge', () => { expect(mockInvoke).toHaveBeenCalledWith('bttask_comments', { taskId: 't1' }); }); - it('updateTaskStatus invokes bttask_update_status', async () => { - mockInvoke.mockResolvedValue(undefined); - await updateTaskStatus('t1', 'done'); - expect(mockInvoke).toHaveBeenCalledWith('bttask_update_status', { taskId: 't1', status: 'done' }); + it('updateTaskStatus invokes bttask_update_status with version', async () => { + mockInvoke.mockResolvedValue(2); + const newVersion = await updateTaskStatus('t1', 'done', 1); + expect(newVersion).toBe(2); + expect(mockInvoke).toHaveBeenCalledWith('bttask_update_status', { taskId: 't1', status: 'done', version: 1 }); }); it('addTaskComment invokes bttask_add_comment', async () => { diff --git a/v2/src/lib/agent-dispatcher.test.ts b/v2/src/lib/agent-dispatcher.test.ts index c1e4ce5..74a4ff1 100644 --- a/v2/src/lib/agent-dispatcher.test.ts +++ b/v2/src/lib/agent-dispatcher.test.ts @@ -18,6 +18,7 @@ const { mockAddPane, mockGetPanes, mockNotify, + mockAddNotification, } = vi.hoisted(() => ({ capturedCallbacks: { msg: null as ((msg: any) => void) | null, @@ -37,6 +38,7 @@ const { mockAddPane: vi.fn(), mockGetPanes: vi.fn().mockReturnValue([]), mockNotify: vi.fn(), + mockAddNotification: vi.fn(), })); vi.mock('./adapters/agent-bridge', () => ({ @@ -171,6 +173,7 @@ vi.mock('./stores/layout.svelte', () => ({ vi.mock('./stores/notifications.svelte', () => ({ notify: (...args: unknown[]) => mockNotify(...args), + addNotification: (...args: unknown[]) => mockAddNotification(...args), })); vi.mock('./stores/conflicts.svelte', () => ({