MCPcopy Index your code
hub / github.com/docker/docker-agent / TestApp_InjectUserMessage

Function TestApp_InjectUserMessage

pkg/app/app_test.go:502–523  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

500// TUI produces when the user submits input — so it flows through the normal
501// run path (queueing, title generation, event streaming).
502func 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}

Callers

nothing calls this directly

Calls 3

InjectUserMessageMethod · 0.95
NewFunction · 0.92
ContextMethod · 0.80

Tested by

no test coverage detected