@@ -47,20 +47,24 @@ func TestShouldShowBlockingPrompt(t *testing.T) {
4747
4848func TestUpdateCommandHint (t * testing.T ) {
4949 tests := []struct {
50- method InstallMethod
51- expected string
50+ name string
51+ method InstallMethod
52+ availableVersion string
53+ expected string
5254 }{
53- {InstallMethodHomebrew , "brew upgrade tdl" },
54- {InstallMethodGoInstall , "go install github.com/ThreeDotsLabs/cli/tdl@latest" },
55- {InstallMethodNix , "nix profile upgrade --flake github:ThreeDotsLabs/cli" },
56- {InstallMethodScoop , "scoop update tdl" },
57- {InstallMethodDirectBinary , "" },
58- {InstallMethodUnknown , "" },
55+ {"homebrew" , InstallMethodHomebrew , "1.2.0" , "brew upgrade tdl" },
56+ {"go install with version" , InstallMethodGoInstall , "1.2.0" , "go install github.com/ThreeDotsLabs/cli/tdl@v1.2.0" },
57+ {"go install with v-prefixed version" , InstallMethodGoInstall , "v1.2.0" , "go install github.com/ThreeDotsLabs/cli/tdl@v1.2.0" },
58+ {"go install without version falls back to latest" , InstallMethodGoInstall , "" , "go install github.com/ThreeDotsLabs/cli/tdl@latest" },
59+ {"nix" , InstallMethodNix , "1.2.0" , "nix profile upgrade --flake github:ThreeDotsLabs/cli" },
60+ {"scoop" , InstallMethodScoop , "1.2.0" , "scoop update tdl" },
61+ {"direct binary" , InstallMethodDirectBinary , "1.2.0" , "" },
62+ {"unknown" , InstallMethodUnknown , "1.2.0" , "" },
5963 }
6064
6165 for _ , tt := range tests {
62- t .Run (tt .method . String () , func (t * testing.T ) {
63- assert .Equal (t , tt .expected , updateCommandHint (tt .method ))
66+ t .Run (tt .name , func (t * testing.T ) {
67+ assert .Equal (t , tt .expected , updateCommandHint (tt .method , tt . availableVersion ))
6468 })
6569 }
6670}
0 commit comments