MCPcopy Create free account
hub / github.com/Chat2AnyLLM/code-agent-manager / keyEvent

Function keyEvent

internal/cli/launch_wizard_test.go:139–155  ·  view source on GitHub ↗

Below: drive the wizard model directly (skipping the bubbletea Program) by feeding key events and inspecting state. This avoids needing a real TTY in tests.

(s string)

Source from the content-addressed store, hash-verified

137// needing a real TTY in tests.
138
139func keyEvent(s string) tea.KeyMsg {
140 switch s {
141 case "enter":
142 return tea.KeyMsg{Type: tea.KeyEnter}
143 case "esc":
144 return tea.KeyMsg{Type: tea.KeyEsc}
145 case "up":
146 return tea.KeyMsg{Type: tea.KeyUp}
147 case "down":
148 return tea.KeyMsg{Type: tea.KeyDown}
149 case "backspace":
150 return tea.KeyMsg{Type: tea.KeyBackspace}
151 case "ctrl+c":
152 return tea.KeyMsg{Type: tea.KeyCtrlC}
153 }
154 return tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune(s)}
155}
156
157func drive(t *testing.T, m launchWizardModel, keys ...string) launchWizardModel {
158 t.Helper()

Calls

no outgoing calls

Tested by

no test coverage detected