--- Tests ---
(t *testing.T)
| 174 | // --- Tests --- |
| 175 | |
| 176 | func TestHuhPrompterInput(t *testing.T) { |
| 177 | tests := []struct { |
| 178 | name string |
| 179 | defaultValue string |
| 180 | ix interaction |
| 181 | wantResult string |
| 182 | }{ |
| 183 | { |
| 184 | name: "basic input", |
| 185 | ix: newInteraction(typeKeys("hello"), enter()), |
| 186 | wantResult: "hello", |
| 187 | }, |
| 188 | { |
| 189 | name: "default value returned when no input", |
| 190 | defaultValue: "default", |
| 191 | ix: newInteraction(enter()), |
| 192 | wantResult: "default", |
| 193 | }, |
| 194 | } |
| 195 | |
| 196 | for _, tt := range tests { |
| 197 | t.Run(tt.name, func(t *testing.T) { |
| 198 | p := newTestHuhPrompter() |
| 199 | f, result := p.buildInputForm("Name:", tt.defaultValue) |
| 200 | runForm(t, f, tt.ix) |
| 201 | require.Equal(t, tt.wantResult, *result) |
| 202 | }) |
| 203 | } |
| 204 | } |
| 205 | |
| 206 | func TestHuhPrompterSelect(t *testing.T) { |
| 207 | tests := []struct { |
nothing calls this directly
no test coverage detected