(t *testing.T)
| 276 | } |
| 277 | |
| 278 | func Test_Send_RejectsDuplicateSend(t *testing.T) { |
| 279 | mClock := quartz.NewMock(t) |
| 280 | mock := newMockAgentIO() |
| 281 | // Block the write so it doesn't complete immediately |
| 282 | started, done := mock.BlockWrite() |
| 283 | |
| 284 | conv := acpio.NewACPConversation(context.Background(), mock, nil, nil, nil, mClock) |
| 285 | conv.Start(context.Background()) |
| 286 | |
| 287 | // First send blocks, so run in a goroutine |
| 288 | errCh := make(chan error, 1) |
| 289 | go func() { errCh <- conv.Send(screentracker.MessagePartText{Content: "first"}) }() |
| 290 | |
| 291 | // Wait for the write to start (ensuring we're in "prompting" state) |
| 292 | <-started |
| 293 | |
| 294 | // Second send while first is processing should fail |
| 295 | err := conv.Send(screentracker.MessagePartText{Content: "second"}) |
| 296 | assert.ErrorIs(t, err, screentracker.ErrMessageValidationChanging) |
| 297 | |
| 298 | // Signal a chunk so executePrompt's timer wait doesn't hang on the mock clock. |
| 299 | mock.SimulateChunks("first response") |
| 300 | |
| 301 | // Unblock the write to let the test complete cleanly |
| 302 | close(done) |
| 303 | require.NoError(t, <-errCh) |
| 304 | } |
| 305 | |
| 306 | func Test_Status_ChangesWhileProcessing(t *testing.T) { |
| 307 | ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) |
nothing calls this directly
no test coverage detected