MCPcopy Create free account
hub / github.com/compozy/agh / TestInstallWizardModelTransitions

Function TestInstallWizardModelTransitions

internal/cli/install_test.go:342–465  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

340}
341
342func TestInstallWizardModelTransitions(t *testing.T) {
343 t.Parallel()
344
345 t.Run("Should transition through provider model and confirmation steps", func(t *testing.T) {
346 t.Parallel()
347
348 model := newInstallWizardModel(installWizardInput{
349 Providers: []string{"claude", "codex"},
350 SelectedProvider: "claude",
351 SuggestedModels: map[string]string{
352 "claude": "claude-sonnet",
353 "codex": "gpt-5.4",
354 },
355 ModelRequired: map[string]bool{
356 "codex": true,
357 },
358 })
359
360 if model.Init() == nil {
361 t.Fatal("Init() = nil, want blink command")
362 }
363 if !strings.Contains(model.View(), "Select the default provider") {
364 t.Fatalf("provider view = %q, want provider prompt", model.View())
365 }
366
367 var cmd tea.Cmd
368 model, cmd = updateInstallWizardModel(t, model, tea.KeyMsg{Type: tea.KeyDown})
369 if cmd != nil {
370 t.Fatalf("provider navigation cmd = %v, want nil", cmd)
371 }
372 if model.selected != 1 {
373 t.Fatalf("selected = %d, want 1", model.selected)
374 }
375
376 model, cmd = updateInstallWizardModel(t, model, tea.KeyMsg{Type: tea.KeyEnter})
377 if cmd == nil {
378 t.Fatal("provider enter cmd = nil, want blink command")
379 }
380 if model.step != installWizardStepModel || model.provider != "codex" {
381 t.Fatalf("provider step transition = %#v, want model step for codex", model)
382 }
383 if model.modelInput.Value() != "gpt-5.4" {
384 t.Fatalf("modelInput.Value() = %q, want %q", model.modelInput.Value(), "gpt-5.4")
385 }
386 if !strings.Contains(model.View(), "Selected provider: codex") {
387 t.Fatalf("model view = %q, want selected provider", model.View())
388 }
389
390 model.modelInput.SetValue("")
391 model, cmd = updateInstallWizardModel(t, model, tea.KeyMsg{Type: tea.KeyEnter})
392 if cmd != nil {
393 t.Fatalf("blank model enter cmd = %v, want nil", cmd)
394 }
395 if model.errText != "model is required" {
396 t.Fatalf("errText = %q, want model is required", model.errText)
397 }
398
399 model.modelInput.SetValue("gpt-5.4")

Callers

nothing calls this directly

Calls 7

newInstallWizardModelFunction · 0.85
updateInstallWizardModelFunction · 0.85
InitMethod · 0.80
ContainsMethod · 0.80
ViewMethod · 0.80
SetValueMethod · 0.80
RunMethod · 0.65

Tested by

no test coverage detected