TestDetectPackageManager verifies detection of specific package managers.
(t *testing.T)
| 159 | |
| 160 | // TestDetectPackageManager verifies detection of specific package managers. |
| 161 | func TestDetectPackageManager(t *testing.T) { |
| 162 | tests := []struct { |
| 163 | name string |
| 164 | binPath string |
| 165 | expected string |
| 166 | }{ |
| 167 | { |
| 168 | name: "Homebrew ARM", |
| 169 | binPath: "/opt/homebrew/bin/tnr", |
| 170 | expected: "homebrew", |
| 171 | }, |
| 172 | { |
| 173 | name: "Homebrew Intel", |
| 174 | binPath: "/usr/local/Cellar/tnr/1.0.0/bin/tnr", |
| 175 | expected: "homebrew", |
| 176 | }, |
| 177 | { |
| 178 | name: "Scoop", |
| 179 | binPath: "C:\\Users\\test\\scoop\\apps\\tnr\\current\\tnr.exe", |
| 180 | expected: "scoop", |
| 181 | }, |
| 182 | { |
| 183 | name: "WindowsApps (winget)", |
| 184 | binPath: "C:\\Program Files\\WindowsApps\\Thunder.tnr\\tnr.exe", |
| 185 | expected: "winget", |
| 186 | }, |
| 187 | { |
| 188 | name: "Unknown", |
| 189 | binPath: "/usr/local/bin/tnr", |
| 190 | expected: "", |
| 191 | }, |
| 192 | } |
| 193 | |
| 194 | for _, tt := range tests { |
| 195 | t.Run(tt.name, func(t *testing.T) { |
| 196 | result := detectPackageManager(tt.binPath) |
| 197 | assert.Equal(t, tt.expected, result) |
| 198 | }) |
| 199 | } |
| 200 | } |
| 201 | |
| 202 | // TestTUIRenderUpToDate verifies that the TUI renders up-to-date message correctly. |
| 203 | func TestTUIRenderUpToDate(t *testing.T) { |
nothing calls this directly
no test coverage detected