MCPcopy Create free account
hub / github.com/netlify/gotrue / TestFunctionHooksUnmarshalJSON

Function TestFunctionHooksUnmarshalJSON

api/middleware_test.go:10–31  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

8)
9
10func 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}

Callers

nothing calls this directly

Calls 1

ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…