(t *testing.T)
| 8 | ) |
| 9 | |
| 10 | func TestFunctionHooksUnmarshalJSON(t *testing.T) { |
| 11 | tests := []struct { |
| 12 | in string |
| 13 | ok bool |
| 14 | }{ |
| 15 | {`{ "signup" : "identity-signup" }`, true}, |
| 16 | {`{ "signup" : ["identity-signup"] }`, true}, |
| 17 | {`{ "signup" : {"foo" : "bar"} }`, false}, |
| 18 | } |
| 19 | for _, tt := range tests { |
| 20 | t.Run(tt.in, func(t *testing.T) { |
| 21 | var f FunctionHooks |
| 22 | err := json.Unmarshal([]byte(tt.in), &f) |
| 23 | if tt.ok { |
| 24 | assert.NoError(t, err) |
| 25 | assert.Equal(t, FunctionHooks{"signup": {"identity-signup"}}, f) |
| 26 | } else { |
| 27 | assert.Error(t, err) |
| 28 | } |
| 29 | }) |
| 30 | } |
| 31 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…