(t *testing.T)
| 8 | ) |
| 9 | |
| 10 | func TestFieldMapper(t *testing.T) { |
| 11 | mapper := jsvm.FieldMapper{} |
| 12 | |
| 13 | scenarios := []struct { |
| 14 | name string |
| 15 | expected string |
| 16 | }{ |
| 17 | {"", ""}, |
| 18 | {"test", "test"}, |
| 19 | {"Test", "test"}, |
| 20 | {"miXeD", "miXeD"}, |
| 21 | {"MiXeD", "miXeD"}, |
| 22 | {"ResolveRequestAsJSON", "resolveRequestAsJSON"}, |
| 23 | {"Variable_with_underscore", "variable_with_underscore"}, |
| 24 | {"ALLCAPS", "allcaps"}, |
| 25 | {"ALL_CAPS_WITH_UNDERSCORE", "all_caps_with_underscore"}, |
| 26 | {"OIDCMap", "oidcMap"}, |
| 27 | {"MD5", "md5"}, |
| 28 | {"OAuth2", "oauth2"}, |
| 29 | } |
| 30 | |
| 31 | for i, s := range scenarios { |
| 32 | field := reflect.StructField{Name: s.name} |
| 33 | if v := mapper.FieldName(nil, field); v != s.expected { |
| 34 | t.Fatalf("[%d] Expected FieldName %q, got %q", i, s.expected, v) |
| 35 | } |
| 36 | |
| 37 | method := reflect.Method{Name: s.name} |
| 38 | if v := mapper.MethodName(nil, method); v != s.expected { |
| 39 | t.Fatalf("[%d] Expected MethodName %q, got %q", i, s.expected, v) |
| 40 | } |
| 41 | } |
| 42 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…