TestApp_InjectUserMessage verifies a follow-up injected by an external driver is published on the event bus as a SendMsg — the same message the TUI produces when the user submits input — so it flows through the normal run path (queueing, title generation, event streaming).
(t *testing.T)
| 500 | // TUI produces when the user submits input — so it flows through the normal |
| 501 | // run path (queueing, title generation, event streaming). |
| 502 | func TestApp_InjectUserMessage(t *testing.T) { |
| 503 | t.Parallel() |
| 504 | |
| 505 | events := make(chan tea.Msg, 4) |
| 506 | app := &App{ |
| 507 | ctx: t.Context, |
| 508 | runtime: &mockRuntime{}, |
| 509 | session: session.New(), |
| 510 | events: events, |
| 511 | } |
| 512 | |
| 513 | app.InjectUserMessage(t.Context(), "do the thing") |
| 514 | |
| 515 | select { |
| 516 | case msg := <-events: |
| 517 | sendMsg, ok := msg.(messages.SendMsg) |
| 518 | require.True(t, ok, "should emit a SendMsg, got %T", msg) |
| 519 | assert.Equal(t, "do the thing", sendMsg.Content) |
| 520 | default: |
| 521 | t.Fatal("expected a SendMsg to be emitted") |
| 522 | } |
| 523 | } |
nothing calls this directly
no test coverage detected