From c4f5dfb52f1413862896370f83ffe10eb3fc5350 Mon Sep 17 00:00:00 2001 From: William Valentin Date: Mon, 23 Feb 2026 20:46:58 -0800 Subject: [PATCH] test: stabilize breaking-change expectations for doctor, tools, and model reset --- src/cli/doctor.test.ts | 6 ++++++ src/gateway/handlers/agent.test.ts | 4 ++-- src/tools/integration.test.ts | 7 +++++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/cli/doctor.test.ts b/src/cli/doctor.test.ts index 9a3911c..40b9fce 100644 --- a/src/cli/doctor.test.ts +++ b/src/cli/doctor.test.ts @@ -225,9 +225,15 @@ models: it('reports WARN for Google Calendar when token missing in file and auth store', async () => { mkdirSync(testDir, { recursive: true }); + process.env.HOME = testDir; const configPath = join(testDir, 'config.yaml'); const credsPath = join(testDir, 'gcal-creds.json'); writeFileSync(credsPath, '{}'); + mkdirSync(join(testDir, '.config/flynn'), { recursive: true }); + writeFileSync( + join(testDir, '.config/flynn/auth.json'), + JSON.stringify({}), + ); writeFileSync(configPath, ` telegram: bot_token: "test-token" diff --git a/src/gateway/handlers/agent.test.ts b/src/gateway/handlers/agent.test.ts index 8d1a50c..0548c70 100644 --- a/src/gateway/handlers/agent.test.ts +++ b/src/gateway/handlers/agent.test.ts @@ -160,7 +160,7 @@ describe('createAgentHandlers command fast-path', () => { modelRouter: modelRouter as unknown as AgentHandlerDeps['modelRouter'], runtimeConfig: { models: { - default: { provider: 'anthropic', model: 'claude-sonnet-4' }, + default: { provider: 'anthropic', model: 'claude-sonnet-4', api_key: 'test-anthropic-key' }, fallback_chain: [], }, } as unknown as AgentHandlerDeps['runtimeConfig'], @@ -198,7 +198,7 @@ describe('createAgentHandlers command fast-path', () => { modelRouter: modelRouter as unknown as AgentHandlerDeps['modelRouter'], runtimeConfig: { models: { - default: { provider: 'anthropic', model: 'claude-sonnet-4' }, + default: { provider: 'anthropic', model: 'claude-sonnet-4', api_key: 'test-anthropic-key' }, fallback_chain: [], }, } as unknown as AgentHandlerDeps['runtimeConfig'], diff --git a/src/tools/integration.test.ts b/src/tools/integration.test.ts index 867b18d..0accce8 100644 --- a/src/tools/integration.test.ts +++ b/src/tools/integration.test.ts @@ -120,10 +120,13 @@ describe('Tool integration (end-to-end)', () => { } // Second call: verify the tool result was included in messages const lastMsg = request.messages[request.messages.length - 1] as { content: unknown[] }; - const resultBlock = lastMsg.content[0] as { type: string; tool_use_id: string; content: string }; + const resultBlock = lastMsg.content[0] as { type: string; tool_use_id: string; content: string; is_error: boolean }; expect(resultBlock.type).toBe('tool_result'); expect(resultBlock.tool_use_id).toBe('c1'); - expect(resultBlock.content).toContain('verify_pass'); + expect(resultBlock.is_error).toBe(true); + expect(resultBlock.content).toContain('[provenance=tool_output'); + expect(resultBlock.content).toContain('tool=shell.exec'); + expect(resultBlock.content).toContain("Tool 'shell.exec' denied:"); return { content: 'Verified tool result',