(t *testing.T, datatype string, values string)
| 142 | } |
| 143 | |
| 144 | func InvalidArrayDataTypeShowsError(t *testing.T, datatype string, values string) { |
| 145 | definition := ` |
| 146 | paths: |
| 147 | /validate: |
| 148 | post: |
| 149 | requestBody: |
| 150 | content: |
| 151 | application/json: |
| 152 | schema: |
| 153 | properties: |
| 154 | myparameter: |
| 155 | type: array |
| 156 | items: |
| 157 | type: ` + datatype + ` |
| 158 | nullable: false |
| 159 | ` |
| 160 | context := NewContextBuilder(). |
| 161 | WithDefinition("myservice", definition). |
| 162 | Build() |
| 163 | |
| 164 | result := RunCli([]string{"myservice", "post-validate", "--myparameter", values}, context) |
| 165 | |
| 166 | expected := "Cannot convert 'myparameter' values '" + values + "' to " + datatype + " array" |
| 167 | if !strings.Contains(result.StdErr, expected) { |
| 168 | t.Errorf("stderr does not contain missing parameter error, expected: %v, got: %v", expected, result.StdErr) |
| 169 | } |
| 170 | } |
| 171 | |
| 172 | func TestAssignNestedObjectKeyShowsError(t *testing.T) { |
| 173 | definition := ` |
no test coverage detected