@@ -43,22 +43,28 @@ func TestIsNewerVersion(t *testing.T) {
4343
4444func TestGetUpdateCommand (t * testing.T ) {
4545 tests := []struct {
46+ name string
4647 method InstallMethod
48+ goos string
4749 want string
4850 }{
49- {InstallHomebrew , "brew upgrade skyhook-io/tap/radar" },
50- {InstallKrew , "kubectl krew upgrade radar" },
51- {InstallScoop , "scoop update radar" },
52- {InstallDirect , "" },
53- {InstallDesktop , "" },
54- {InstallMethod ("unknown" ), "" },
51+ {"homebrew" , InstallHomebrew , "darwin" , "brew upgrade skyhook-io/tap/radar" },
52+ {"krew" , InstallKrew , "linux" , "kubectl krew upgrade radar" },
53+ {"scoop" , InstallScoop , "windows" , "scoop update radar" },
54+ {"direct linux" , InstallDirect , "linux" , "curl -fsSL https://get.radarhq.io | sh" },
55+ {"direct darwin" , InstallDirect , "darwin" , "curl -fsSL https://get.radarhq.io | sh" },
56+ {"direct windows" , InstallDirect , "windows" , "irm https://get.radarhq.io/install.ps1 | iex" },
57+ {"direct freebsd falls through" , InstallDirect , "freebsd" , "" },
58+ {"direct empty goos falls through" , InstallDirect , "" , "" },
59+ {"desktop" , InstallDesktop , "darwin" , "" },
60+ {"unknown" , InstallMethod ("unknown" ), "linux" , "" },
5561 }
5662
5763 for _ , tt := range tests {
58- t .Run (string ( tt .method ) , func (t * testing.T ) {
59- got := getUpdateCommand (tt .method )
64+ t .Run (tt .name , func (t * testing.T ) {
65+ got := getUpdateCommandForOS (tt .method , tt . goos )
6066 if got != tt .want {
61- t .Errorf ("getUpdateCommand (%q) = %q, want %q" , tt .method , got , tt .want )
67+ t .Errorf ("getUpdateCommandForOS (%q, %q ) = %q, want %q" , tt .method , tt . goos , got , tt .want )
6268 }
6369 })
6470 }
0 commit comments