MCPcopy
hub / github.com/gofiber/fiber / Test_ConstraintCheckConstraint_InvalidMetadata

Function Test_ConstraintCheckConstraint_InvalidMetadata

path_test.go:264–325  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

262}
263
264func Test_ConstraintCheckConstraint_InvalidMetadata(t *testing.T) {
265 t.Parallel()
266
267 testCases := []struct {
268 name string
269 param string
270 constraint Constraint
271 }{
272 {
273 name: "minLen invalid metadata",
274 constraint: *newConstraint(minLenConstraintType{}, ConstraintMinLen, []string{"abc"}),
275 param: "abcd",
276 },
277 {
278 name: "maxLen invalid metadata",
279 constraint: *newConstraint(maxLenConstraintType{}, ConstraintMaxLen, []string{"abc"}),
280 param: "abcd",
281 },
282 {
283 name: "len invalid metadata",
284 constraint: *newConstraint(lenConstraintType{}, ConstraintLen, []string{"abc"}),
285 param: "abcd",
286 },
287 {
288 name: "betweenLen invalid first metadata",
289 constraint: *newConstraint(betweenLenConstraintType{}, ConstraintBetweenLen, []string{"abc", "5"}),
290 param: "abcd",
291 },
292 {
293 name: "betweenLen invalid second metadata",
294 constraint: *newConstraint(betweenLenConstraintType{}, ConstraintBetweenLen, []string{"1", "abc"}),
295 param: "abcd",
296 },
297 {
298 name: "min invalid metadata",
299 constraint: *newConstraint(minConstraintType{}, ConstraintMin, []string{"abc"}),
300 param: "10",
301 },
302 {
303 name: "max invalid metadata",
304 constraint: *newConstraint(maxConstraintType{}, ConstraintMax, []string{"abc"}),
305 param: "10",
306 },
307 {
308 name: "range invalid first metadata",
309 constraint: *newConstraint(rangeConstraintType{}, ConstraintRange, []string{"abc", "10"}),
310 param: "7",
311 },
312 {
313 name: "range invalid second metadata",
314 constraint: *newConstraint(rangeConstraintType{}, ConstraintRange, []string{"1", "abc"}),
315 param: "7",
316 },
317 }
318
319 for _, testCase := range testCases {
320 t.Run(testCase.name, func(t *testing.T) {
321 t.Parallel()

Callers

nothing calls this directly

Calls 2

newConstraintFunction · 0.85
CheckConstraintMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…