MCPcopy Create free account
hub / github.com/apache/devlake / TestSaveToConfig

Function TestSaveToConfig

backend/helpers/pluginhelper/api/config_util_test.go:46–66  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

44}
45
46func TestSaveToConfig(t *testing.T) {
47 ts := TestStruct{
48 F1: "123",
49 F2: 76,
50 F3: 1.23,
51 F4: "Test",
52 F5: "No Use",
53 }
54 data := make(map[string]interface{})
55
56 v := config.GetConfig()
57 assert.Nil(t, DecodeStruct(v, &ts, data, "env"))
58 v1 := v.GetString("TEST_F1")
59 assert.Equal(t, v1, "123")
60 v2 := v.GetInt("TEST_F2")
61 assert.Equal(t, v2, 76)
62 v3 := v.GetFloat64("TEST_F3")
63 assert.Equal(t, v3, 1.23)
64 v4 := v.GetString("TEST_F4")
65 assert.Equal(t, v4, "Test")
66}
67
68func TestSaveToComplexityConfig(t *testing.T) {
69 ts := TestComplexStruct{

Callers

nothing calls this directly

Calls 5

DecodeStructFunction · 0.85
GetStringMethod · 0.80
GetIntMethod · 0.80
GetFloat64Method · 0.80
GetConfigMethod · 0.65

Tested by

no test coverage detected