(t *testing.T)
| 19 | } |
| 20 | |
| 21 | func 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: ` |
| 38 | apps: |
| 39 | - name: BestConfig |
| 40 | access-key: FamousKey |
| 41 | access-secret-key: TopSecret |
| 42 | chat-url: https://chat.stream-io-api.com |
| 43 | default: 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: ` |
| 56 | apps: |
| 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 |
| 65 | default: 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 | }, |
nothing calls this directly
no test coverage detected