-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlist_test.go
More file actions
68 lines (64 loc) · 1.73 KB
/
list_test.go
File metadata and controls
68 lines (64 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package cmd
import (
"testing"
"github.com/CodingWithCalvin/dtvem.cli/src/internal/tui"
)
func TestGetVersionStatusWithLifecycle(t *testing.T) {
tests := []struct {
name string
version string
globalVersion string
localVersion string
lifecycleStatus string
want string
}{
{
name: "lifecycle only",
version: "22.14.0",
globalVersion: "",
localVersion: "",
lifecycleStatus: "Active LTS",
want: tui.RenderLifecycleStatus("Active LTS"),
},
{
name: "global only",
version: "22.14.0",
globalVersion: "22.14.0",
localVersion: "",
lifecycleStatus: "",
want: globalIndicator + " global",
},
{
name: "global with lifecycle",
version: "22.14.0",
globalVersion: "22.14.0",
localVersion: "",
lifecycleStatus: "Active LTS",
want: globalIndicator + " global" + " · " + tui.RenderLifecycleStatus("Active LTS"),
},
{
name: "local with lifecycle",
version: "22.14.0",
globalVersion: "",
localVersion: "22.14.0",
lifecycleStatus: "Maintenance LTS",
want: localIndicator + " local" + " · " + tui.RenderLifecycleStatus("Maintenance LTS"),
},
{
name: "no status at all",
version: "22.14.0",
globalVersion: "",
localVersion: "",
lifecycleStatus: "",
want: "",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got := getVersionStatusWithLifecycle(tt.version, tt.globalVersion, tt.localVersion, tt.lifecycleStatus)
if got != tt.want {
t.Errorf("getVersionStatusWithLifecycle() = %q, want %q", got, tt.want)
}
})
}
}