Skip to content

Commit 319f516

Browse files
committed
fix unit tests
1 parent c5a7eb9 commit 319f516

File tree

1 file changed

+7
-17
lines changed

1 file changed

+7
-17
lines changed

backend/src/__tests__/subagent-streaming.test.ts

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,7 @@ describe('Subagent Streaming', () => {
168168
await result
169169

170170
// Verify that subagent streaming messages were sent
171-
expect(mockSendSubagentChunk).toHaveBeenCalledTimes(2)
172-
expect(mockWriteToClient).toHaveBeenCalledTimes(2)
171+
expect(mockWriteToClient).toHaveBeenCalledTimes(4)
173172

174173
// First streaming chunk is a labled divider
175174
expect(mockWriteToClient).toHaveBeenNthCalledWith(1, {
@@ -180,25 +179,16 @@ describe('Subagent Streaming', () => {
180179
})
181180

182181
// Check first streaming chunk
183-
expect(mockSendSubagentChunk).toHaveBeenNthCalledWith(1, {
184-
userInputId: 'test-input',
185-
agentId: expect.any(String),
186-
agentType: 'thinker',
187-
chunk: 'Thinking about the problem...',
188-
prompt: 'Think about this problem',
189-
})
182+
expect(mockWriteToClient).toHaveBeenNthCalledWith(
183+
2,
184+
'Thinking about the problem...',
185+
)
190186

191187
// Check second streaming chunk
192-
expect(mockSendSubagentChunk).toHaveBeenNthCalledWith(2, {
193-
userInputId: 'test-input',
194-
agentId: expect.any(String),
195-
agentType: 'thinker',
196-
chunk: 'Found a solution!',
197-
prompt: 'Think about this problem',
198-
})
188+
expect(mockWriteToClient).toHaveBeenNthCalledWith(3, 'Found a solution!')
199189

200190
// Last streaming chunk is a labeled divider
201-
expect(mockWriteToClient).toHaveBeenNthCalledWith(2, {
191+
expect(mockWriteToClient).toHaveBeenNthCalledWith(4, {
202192
type: 'subagent_finish',
203193
agentId: 'thinker',
204194
displayName: 'Thinker',

0 commit comments

Comments
 (0)