MCPcopy Index your code
hub / github.com/bytebase/bytebase / TestGetValueWithKey

Function TestGetValueWithKey

backend/plugin/idp/util_test.go:10–40  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

8)
9
10func TestGetValueWithKey(t *testing.T) {
11 tests := []struct {
12 data map[string]any
13 key string
14 want any
15 }{
16 {
17 data: map[string]any{
18 "user": "test",
19 },
20 key: "user",
21 want: "test",
22 },
23 {
24 data: map[string]any{
25 "data": map[string]any{
26 "user": "test",
27 },
28 },
29 key: "data.user",
30 want: "test",
31 },
32 }
33
34 for _, test := range tests {
35 got := GetValueWithKey(test.data, test.key)
36 if test.want != got {
37 t.Errorf("GetValueWithKey got %v but want %v", got, test.want)
38 }
39 }
40}
41
42func TestGetValueWithKeyFromJSONString(t *testing.T) {
43 tests := []struct {

Callers

nothing calls this directly

Calls 2

GetValueWithKeyFunction · 0.85
ErrorfMethod · 0.80

Tested by

no test coverage detected