diff --git a/services/kiloclaw/plugins/kilo-chat/src/channel.test.ts b/services/kiloclaw/plugins/kilo-chat/src/channel.test.ts index 1e48ca0961..8dab11dffc 100644 --- a/services/kiloclaw/plugins/kilo-chat/src/channel.test.ts +++ b/services/kiloclaw/plugins/kilo-chat/src/channel.test.ts @@ -1,4 +1,3 @@ -import { readFile } from 'node:fs/promises'; import { describe, expect, it, vi } from 'vitest'; import { __pluginInternals, kiloChatPlugin } from './channel'; @@ -260,22 +259,6 @@ describe('kilo-chat actions adapter', () => { expect(adapter?.resolveExecutionMode?.({ action: 'react' as never })).toBe('local'); }); - it('routes send actions before constructing the shared action client', async () => { - const source = await readFile(new URL('./channel.ts', import.meta.url), 'utf8'); - const handleActionIndex = source.indexOf( - 'handleAction: async (ctx: ChannelMessageActionContext)' - ); - const sendBranchIndex = source.indexOf( - "if (ctx.action === 'send' || ctx.action === 'upload-file')", - handleActionIndex - ); - const sharedClientIndex = source.indexOf('const client = makeClient();', handleActionIndex); - - expect(handleActionIndex).toBeGreaterThanOrEqual(0); - expect(sendBranchIndex).toBeGreaterThan(handleActionIndex); - expect(sharedClientIndex).toBeGreaterThan(sendBranchIndex); - }); - it('handles send with a base64 buffer as an arbitrary attachment', async () => { const calls: Array<{ url: string; init: RequestInit }> = []; const fetchImpl = vi.fn(async (input: string | URL, init?: RequestInit) => { diff --git a/services/kiloclaw/plugins/kilo-chat/src/client.test.ts b/services/kiloclaw/plugins/kilo-chat/src/client.test.ts index 277dc6063c..8711e96fbb 100644 --- a/services/kiloclaw/plugins/kilo-chat/src/client.test.ts +++ b/services/kiloclaw/plugins/kilo-chat/src/client.test.ts @@ -128,35 +128,6 @@ describe('createKiloChatClient', () => { const body = JSON.parse((init as RequestInit).body as string); expect(body.inReplyToMessageId).toBeUndefined(); }); - - it('createMessage posts to /_kilo/kilo-chat/send and returns messageId', async () => { - const fetchImpl = vi.fn( - async () => - new Response(JSON.stringify(createMessageResponse()), { - status: 200, - headers: { 'content-type': 'application/json' }, - }) - ); - const client = createKiloChatClient({ - controllerBaseUrl: 'http://127.0.0.1:18789', - gatewayToken: 'gwt', - fetchImpl: fetchImpl as unknown as typeof fetch, - }); - - const result = await client.createMessage({ - conversationId: 'c1', - content: [{ type: 'text', text: 'hello' }], - }); - - expect(fetchImpl).toHaveBeenCalledTimes(1); - const [url, init] = fetchImpl.mock.calls[0]!; - expect(url).toBe('http://127.0.0.1:18789/_kilo/kilo-chat/send'); - const init2 = init as RequestInit; - expect(init2.method).toBe('POST'); - const body = JSON.parse(init2.body as string); - expect(body).toEqual({ conversationId: 'c1', content: [{ type: 'text', text: 'hello' }] }); - expect(result.messageId).toBe('m1'); - }); }); describe('editMessage', () => { diff --git a/services/kiloclaw/plugins/kiloclaw-morning-briefing/src/index.web-search-query.test.ts b/services/kiloclaw/plugins/kiloclaw-morning-briefing/src/index.web-search-query.test.ts deleted file mode 100644 index 9f8771f451..0000000000 --- a/services/kiloclaw/plugins/kiloclaw-morning-briefing/src/index.web-search-query.test.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { describe, expect, it, vi } from 'vitest'; - -// The same Typebox/plugin-entry mocks as index.lifecycle.test.ts so we -// can import the module without the controller SDK installed. -vi.mock('@sinclair/typebox', () => ({ - Type: { - Object: (value: unknown) => value, - Optional: (value: unknown) => value, - String: (value: unknown) => value, - Union: (value: unknown) => value, - Literal: (value: unknown) => value, - }, -})); - -vi.mock('openclaw/plugin-sdk/plugin-entry', () => ({ - definePluginEntry: (entry: unknown) => entry, -})); - -import { buildBriefingWebSearchQuery } from './index'; - -describe('buildBriefingWebSearchQuery', () => { - // Function now interpolates a single topic per call (per-topic loop - // pattern). `collectWebSearch` short-circuits to a nudge when no - // topics are selected and runs this builder once per remaining topic. - - it('interpolates a topic into the query string', () => { - expect(buildBriefingWebSearchQuery('Tech')).toBe( - 'latest news and updates on Tech from the last 24 hours' - ); - }); - - it('interpolates a multi-word topic verbatim', () => { - expect(buildBriefingWebSearchQuery('Health Tech')).toBe( - 'latest news and updates on Health Tech from the last 24 hours' - ); - }); - - it('does not trim — caller is responsible for sanitisation', () => { - // The collectWebSearch caller trims + filters empty topics. This - // function trusts the input so the same call site can build - // arbitrary queries without re-trimming. - expect(buildBriefingWebSearchQuery(' Markets ')).toBe( - 'latest news and updates on Markets from the last 24 hours' - ); - }); -});