Skip to content

Commit c25dba8

Browse files
committed
Fix unit tests
1 parent 3271993 commit c25dba8

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

backend/src/__tests__/cost-aggregation.integration.test.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import { mainPrompt } from '../main-prompt'
2222
import * as agentRegistry from '../templates/agent-registry'
2323
import * as websocketAction from '../websockets/websocket-action'
2424

25+
import type { AgentTemplate } from '../templates/types'
2526
import type { ProjectFileContext } from '@codebuff/common/util/file'
2627
import type { WebSocket } from 'ws'
2728

@@ -139,12 +140,13 @@ describe('Cost Aggregation Integration Tests', () => {
139140
spawnerPrompt: '',
140141
model: 'gpt-4o-mini',
141142
includeMessageHistory: true,
143+
mcpServers: {},
142144
toolNames: ['spawn_agents'],
143145
spawnableAgents: ['editor'],
144146
systemPrompt: 'Base agent system prompt',
145147
instructionsPrompt: 'Base agent instructions',
146148
stepPrompt: 'Base agent step prompt',
147-
},
149+
} satisfies AgentTemplate,
148150
editor: {
149151
id: 'editor',
150152
displayName: 'Editor Agent',
@@ -153,12 +155,13 @@ describe('Cost Aggregation Integration Tests', () => {
153155
spawnerPrompt: '',
154156
model: 'gpt-4o-mini',
155157
includeMessageHistory: true,
158+
mcpServers: {},
156159
toolNames: ['write_file'],
157160
spawnableAgents: [],
158161
systemPrompt: 'Editor agent system prompt',
159162
instructionsPrompt: 'Editor agent instructions',
160163
stepPrompt: 'Editor agent step prompt',
161-
},
164+
} satisfies AgentTemplate,
162165
}
163166

164167
// Mock cost tracking to return 0 so only onCostCalculated contributes

backend/src/__tests__/main-prompt.test.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import { mainPrompt } from '../main-prompt'
3232
import * as processFileBlockModule from '../process-file-block'
3333
import * as websocketAction from '../websockets/websocket-action'
3434

35+
import type { AgentTemplate } from '@codebuff/common/types/agent-template'
3536
import type { ProjectFileContext } from '@codebuff/common/util/file'
3637
import type { WebSocket } from 'ws'
3738

@@ -56,12 +57,13 @@ describe('mainPrompt', () => {
5657
spawnerPrompt: '',
5758
model: 'gpt-4o-mini',
5859
includeMessageHistory: true,
60+
mcpServers: {},
5961
toolNames: ['write_file', 'run_terminal_command'],
6062
spawnableAgents: [],
6163
systemPrompt: '',
6264
instructionsPrompt: '',
6365
stepPrompt: '',
64-
},
66+
} satisfies AgentTemplate,
6567
[AgentTemplateTypes.base_max]: {
6668
id: AgentTemplateTypes.base_max,
6769
displayName: 'Base Max Agent',
@@ -70,12 +72,13 @@ describe('mainPrompt', () => {
7072
spawnerPrompt: '',
7173
model: 'gpt-4o',
7274
includeMessageHistory: true,
75+
mcpServers: {},
7376
toolNames: ['write_file', 'run_terminal_command'],
7477
spawnableAgents: [],
7578
systemPrompt: '',
7679
instructionsPrompt: '',
7780
stepPrompt: '',
78-
},
81+
} satisfies AgentTemplate,
7982
}
8083
})
8184

backend/src/__tests__/malformed-tool-call.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ describe('malformed tool call error handling', () => {
311311
expect(errorMessage).toBeDefined()
312312
expect(
313313
(errorMessage?.content.output?.[0] as any)?.value?.errorMessage,
314-
).toContain('Tool not found: unknown_tool')
314+
).toContain('Tool unknown_tool not found')
315315
})
316316

317317
test('should not affect valid tool calls in message history', async () => {

0 commit comments

Comments
 (0)