(t *testing.T)
| 879 | } |
| 880 | |
| 881 | func TestValueBinder_Int64s_intsValue(t *testing.T) { |
| 882 | var testCases = []struct { |
| 883 | name string |
| 884 | whenURL string |
| 885 | expectError string |
| 886 | givenBindErrors []error |
| 887 | expectValue []int64 |
| 888 | givenFailFast bool |
| 889 | whenMust bool |
| 890 | }{ |
| 891 | { |
| 892 | name: "ok, binds value", |
| 893 | whenURL: "/search?param=1¶m=2¶m=1", |
| 894 | expectValue: []int64{1, 2, 1}, |
| 895 | }, |
| 896 | { |
| 897 | name: "ok, params values empty, value is not changed", |
| 898 | whenURL: "/search?nope=1", |
| 899 | expectValue: []int64{99}, |
| 900 | }, |
| 901 | { |
| 902 | name: "nok, previous errors fail fast without binding value", |
| 903 | givenFailFast: true, |
| 904 | whenURL: "/search?param=1¶m=100", |
| 905 | expectValue: []int64{99}, |
| 906 | expectError: "previous error", |
| 907 | }, |
| 908 | { |
| 909 | name: "nok, conversion fails, value is not changed", |
| 910 | whenURL: "/search?param=nope¶m=100", |
| 911 | expectValue: []int64{99}, |
| 912 | expectError: "code=400, message=failed to bind field value to int64, err=strconv.ParseInt: parsing \"nope\": invalid syntax, field=param", |
| 913 | }, |
| 914 | { |
| 915 | name: "ok (must), binds value", |
| 916 | whenMust: true, |
| 917 | whenURL: "/search?param=1¶m=2¶m=1", |
| 918 | expectValue: []int64{1, 2, 1}, |
| 919 | }, |
| 920 | { |
| 921 | name: "ok (must), params values empty, returns error, value is not changed", |
| 922 | whenMust: true, |
| 923 | whenURL: "/search?nope=1", |
| 924 | expectValue: []int64{99}, |
| 925 | expectError: "code=400, message=required field value is empty, field=param", |
| 926 | }, |
| 927 | { |
| 928 | name: "nok (must), previous errors fail fast without binding value", |
| 929 | givenFailFast: true, |
| 930 | whenMust: true, |
| 931 | whenURL: "/search?param=1¶m=100", |
| 932 | expectValue: []int64{99}, |
| 933 | expectError: "previous error", |
| 934 | }, |
| 935 | { |
| 936 | name: "nok (must), conversion fails, value is not changed", |
| 937 | whenMust: true, |
| 938 | whenURL: "/search?param=nope¶m=100", |
nothing calls this directly
no test coverage detected
searching dependent graphs…