(t *testing.T)
| 271 | } |
| 272 | |
| 273 | func TestCheckForUpdatesInCIMode(t *testing.T) { |
| 274 | // Save original environment and function |
| 275 | origCI := os.Getenv("CI") |
| 276 | origGetLastCheckFilePath := getLastCheckFilePathFunc |
| 277 | defer func() { |
| 278 | os.Setenv("CI", origCI) |
| 279 | getLastCheckFilePathFunc = origGetLastCheckFilePath |
| 280 | }() |
| 281 | |
| 282 | // Set CI environment |
| 283 | os.Setenv("CI", "true") |
| 284 | |
| 285 | // Create temporary directory for last check file |
| 286 | tmpDir := t.TempDir() |
| 287 | lastCheckFile := filepath.Join(tmpDir, lastCheckFileName) |
| 288 | |
| 289 | // Override the function to use temp directory |
| 290 | getLastCheckFilePathFunc = func() string { |
| 291 | return lastCheckFile |
| 292 | } |
| 293 | |
| 294 | // Call checkForUpdates |
| 295 | checkForUpdates(false, false) |
| 296 | |
| 297 | // Verify that no last check file was created (since check was skipped in CI) |
| 298 | if _, err := os.Stat(lastCheckFile); err == nil { |
| 299 | t.Error("Last check file should not be created in CI mode") |
| 300 | } |
| 301 | } |
| 302 | |
| 303 | func TestCheckForUpdatesAsync_ContextCancellation(t *testing.T) { |
| 304 | // Test that async update check respects context cancellation |
nothing calls this directly
no test coverage detected