MCPcopy
hub / github.com/moncho/dry / TestModel_PromptConfirm

Function TestModel_PromptConfirm

app/model_test.go:249–271  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

247}
248
249func TestModel_PromptConfirm(t *testing.T) {
250 m := newTestModel()
251
252 // Show a prompt
253 m = m.showPrompt("Test?", "kill", "abc123def456")
254 if m.overlay != overlayPrompt {
255 t.Fatal("expected overlayPrompt")
256 }
257
258 // Confirm — sends PromptResultMsg
259 result, cmd := m.Update(tea.KeyPressMsg{Code: 'y'})
260 m = result.(model)
261
262 if cmd == nil {
263 t.Fatal("expected cmd from prompt confirm")
264 }
265
266 // Execute the cmd — should produce PromptResultMsg
267 msg := cmd()
268 if _, ok := msg.(appui.PromptResultMsg); !ok {
269 t.Fatalf("expected PromptResultMsg, got %T", msg)
270 }
271}
272
273func TestModel_PromptDeny(t *testing.T) {
274 m := newTestModel()

Callers

nothing calls this directly

Calls 3

newTestModelFunction · 0.85
showPromptMethod · 0.80
UpdateMethod · 0.45

Tested by

no test coverage detected