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

Function InvalidDataTypeShowsError

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

Source from the content-addressed store, hash-verified

110}
111
112func InvalidDataTypeShowsError(t *testing.T, datatype string) {
113 definition := `
114paths:
115 /validate:
116 post:
117 requestBody:
118 content:
119 application/json:
120 schema:
121 properties:
122 myparameter:
123 type: ` + datatype + `
124 nullable: false
125`
126 context := NewContextBuilder().
127 WithDefinition("myservice", definition).
128 Build()
129
130 result := RunCli([]string{"myservice", "post-validate", "--myparameter", "INVALID"}, context)
131
132 expected := "Cannot convert 'myparameter' value 'INVALID' to " + datatype
133 if !strings.Contains(result.StdErr, expected) {
134 t.Errorf("stderr does not contain missing parameter error, expected: %v, got: %v", expected, result.StdErr)
135 }
136}
137
138func TestInvalidArrayDataTypesShowError(t *testing.T) {
139 t.Run("Integer", func(t *testing.T) { InvalidArrayDataTypeShowsError(t, "integer", "1,INVALID,3") })

Callers 1

Calls 4

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

Tested by

no test coverage detected