MCPcopy Index your code
hub / github.com/labstack/echo / TestValueBinder_Uint64s_uintsValue

Function TestValueBinder_Uint64s_uintsValue

binder_test.go:970–1057  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

968}
969
970func TestValueBinder_Uint64s_uintsValue(t *testing.T) {
971 var testCases = []struct {
972 name string
973 whenURL string
974 expectError string
975 givenBindErrors []error
976 expectValue []uint64
977 givenFailFast bool
978 whenMust bool
979 }{
980 {
981 name: "ok, binds value",
982 whenURL: "/search?param=1&param=2&param=1",
983 expectValue: []uint64{1, 2, 1},
984 },
985 {
986 name: "ok, params values empty, value is not changed",
987 whenURL: "/search?nope=1",
988 expectValue: []uint64{99},
989 },
990 {
991 name: "nok, previous errors fail fast without binding value",
992 givenFailFast: true,
993 whenURL: "/search?param=1&param=100",
994 expectValue: []uint64{99},
995 expectError: "previous error",
996 },
997 {
998 name: "nok, conversion fails, value is not changed",
999 whenURL: "/search?param=nope&param=100",
1000 expectValue: []uint64{99},
1001 expectError: "code=400, message=failed to bind field value to uint64, err=strconv.ParseUint: parsing \"nope\": invalid syntax, field=param",
1002 },
1003 {
1004 name: "ok (must), binds value",
1005 whenMust: true,
1006 whenURL: "/search?param=1&param=2&param=1",
1007 expectValue: []uint64{1, 2, 1},
1008 },
1009 {
1010 name: "ok (must), params values empty, returns error, value is not changed",
1011 whenMust: true,
1012 whenURL: "/search?nope=1",
1013 expectValue: []uint64{99},
1014 expectError: "code=400, message=required field value is empty, field=param",
1015 },
1016 {
1017 name: "nok (must), previous errors fail fast without binding value",
1018 givenFailFast: true,
1019 whenMust: true,
1020 whenURL: "/search?param=1&param=100",
1021 expectValue: []uint64{99},
1022 expectError: "previous error",
1023 },
1024 {
1025 name: "nok (must), conversion fails, value is not changed",
1026 whenMust: true,
1027 whenURL: "/search?param=nope&param=100",

Callers

nothing calls this directly

Calls 6

createTestContextFunction · 0.85
QueryParamsBinderFunction · 0.85
FailFastMethod · 0.80
BindErrorMethod · 0.80
MustUint64sMethod · 0.80
Uint64sMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…