MCPcopy Create free account
hub / github.com/UiPath/uipathcli / InvalidArrayDataTypeShowsError

Function InvalidArrayDataTypeShowsError

test/validation_test.go:144–170  ·  view source on GitHub ↗
(t *testing.T, datatype string, values string)

Source from the content-addressed store, hash-verified

142}
143
144func InvalidArrayDataTypeShowsError(t *testing.T, datatype string, values string) {
145 definition := `
146paths:
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
172func TestAssignNestedObjectKeyShowsError(t *testing.T) {
173 definition := `

Callers 1

Calls 4

NewContextBuilderFunction · 0.85
RunCliFunction · 0.85
WithDefinitionMethod · 0.80
BuildMethod · 0.45

Tested by

no test coverage detected