...
1 package api
2
3 import "testing"
4
5 func TestRunningModeList_String(t *testing.T) {
6 tests := []struct {
7 name string
8 o RunningModes
9 want string
10 }{
11 {
12 name: "only dev",
13 o: RunningModes{
14 "dev": true,
15 "deploy": false,
16 },
17 want: "Dev",
18 },
19 {
20 name: "only deploy",
21 o: RunningModes{
22 "dev": false,
23 "deploy": true,
24 },
25 want: "Deploy",
26 },
27 {
28 name: "both",
29 o: RunningModes{
30 "dev": true,
31 "deploy": true,
32 },
33 want: "Dev, Deploy",
34 },
35 {
36 name: "none",
37 o: RunningModes{
38 "dev": false,
39 "deploy": false,
40 },
41 want: "None",
42 },
43 }
44 for _, tt := range tests {
45 t.Run(tt.name, func(t *testing.T) {
46 if got := tt.o.String(); got != tt.want {
47 t.Errorf("RunningModeList.String() = %v, want %v", got, tt.want)
48 }
49 })
50 }
51 }
52
View as plain text