MCPcopy Create free account
hub / github.com/GetStream/stream-cli / TestAddNewConfig

Function TestAddNewConfig

pkg/config/config_test.go:21–101  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

19}
20
21func TestAddNewConfig(t *testing.T) {
22 tests := []struct {
23 name string
24 appConfig func() App
25 expected string
26 errored bool
27 }{
28 {
29 name: "add first configuration",
30 appConfig: func() App {
31 app := App{ChatURL: DefaultChatEdgeURL}
32 app.Name = "BestConfig"
33 app.AccessKey = "FamousKey"
34 app.AccessSecretKey = "TopSecret"
35 return app
36 },
37 expected: `
38apps:
39 - name: BestConfig
40 access-key: FamousKey
41 access-secret-key: TopSecret
42 chat-url: https://chat.stream-io-api.com
43default: BestConfig
44`,
45 },
46 {
47 name: "add second configuration",
48 appConfig: func() App {
49 app := App{ChatURL: DefaultChatEdgeURL}
50 app.Name = "BestConfigEver"
51 app.AccessKey = "FamousKey"
52 app.AccessSecretKey = "TopSecret"
53 return app
54 },
55 expected: `
56apps:
57 - name: BestConfig
58 access-key: FamousKey
59 access-secret-key: TopSecret
60 chat-url: https://chat.stream-io-api.com
61 - name: BestConfigEver
62 access-key: FamousKey
63 access-secret-key: TopSecret
64 chat-url: https://chat.stream-io-api.com
65default: BestConfig
66`,
67 },
68 {
69 name: "add already existing configuration",
70 appConfig: func() App {
71 app := App{ChatURL: DefaultChatEdgeURL}
72 app.Name = "BestConfig"
73 app.AccessKey = "FamousKey"
74 app.AccessSecretKey = "TopSecret"
75 return app
76 },
77 errored: true,
78 },

Callers

nothing calls this directly

Calls 3

AddMethod · 0.95
getTempFileFunction · 0.85
getNormalizedStringFunction · 0.85

Tested by

no test coverage detected