--- Tests ---
(t *testing.T)
| 132 | // --- Tests --- |
| 133 | |
| 134 | func TestHuhPrompterInput(t *testing.T) { |
| 135 | tests := []struct { |
| 136 | name string |
| 137 | defaultValue string |
| 138 | ix interaction |
| 139 | wantResult string |
| 140 | }{ |
| 141 | { |
| 142 | name: "basic input", |
| 143 | ix: newInteraction(typeKeys("hello"), enter()), |
| 144 | wantResult: "hello", |
| 145 | }, |
| 146 | { |
| 147 | name: "default value returned when no input", |
| 148 | defaultValue: "default", |
| 149 | ix: newInteraction(enter()), |
| 150 | wantResult: "default", |
| 151 | }, |
| 152 | } |
| 153 | |
| 154 | for _, tt := range tests { |
| 155 | t.Run(tt.name, func(t *testing.T) { |
| 156 | p := newTestHuhPrompter() |
| 157 | f, result := p.buildInputForm("Name:", tt.defaultValue) |
| 158 | runForm(t, f, tt.ix) |
| 159 | require.Equal(t, tt.wantResult, *result) |
| 160 | }) |
| 161 | } |
| 162 | } |
| 163 | |
| 164 | func TestHuhPrompterSelect(t *testing.T) { |
| 165 | tests := []struct { |
nothing calls this directly
no test coverage detected