(t *testing.T)
| 304 | } |
| 305 | |
| 306 | func Test_Status_ChangesWhileProcessing(t *testing.T) { |
| 307 | ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) |
| 308 | defer cancel() |
| 309 | |
| 310 | mClock := quartz.NewMock(t) |
| 311 | mock := newMockAgentIO() |
| 312 | emitter := newMockEmitter() |
| 313 | // Block the write so we can observe status changes |
| 314 | started, done := mock.BlockWrite() |
| 315 | |
| 316 | conv := acpio.NewACPConversation(ctx, mock, nil, nil, emitter, mClock) |
| 317 | conv.Start(ctx) |
| 318 | |
| 319 | // Send blocks, so run in a goroutine |
| 320 | errCh := make(chan error, 1) |
| 321 | go func() { errCh <- conv.Send(screentracker.MessagePartText{Content: "test"}) }() |
| 322 | |
| 323 | // Wait for write to start |
| 324 | <-started |
| 325 | |
| 326 | // Status should be changing while processing |
| 327 | assert.Equal(t, screentracker.ConversationStatusChanging, conv.Status()) |
| 328 | |
| 329 | // Signal a chunk so executePrompt's timer wait doesn't hang on the mock clock. |
| 330 | mock.SimulateChunks("test response") |
| 331 | |
| 332 | // Unblock the write |
| 333 | close(done) |
| 334 | |
| 335 | // Wait for Send to complete - status should then be stable. |
| 336 | require.NoError(t, <-errCh) |
| 337 | emitter.WaitForStatus(ctx, t, screentracker.ConversationStatusStable) |
| 338 | } |
| 339 | |
| 340 | func Test_Text_ReturnsStreamingContent(t *testing.T) { |
| 341 | mClock := quartz.NewMock(t) |
nothing calls this directly
no test coverage detected