(t *testing.T)
| 307 | } |
| 308 | |
| 309 | func TestProgressBarNonTTYFallback(t *testing.T) { |
| 310 | // This test documents the expected behavior in non-TTY environments |
| 311 | t.Run("non-TTY output is human readable", func(t *testing.T) { |
| 312 | // Skip if running in TTY mode as we can't test the fallback |
| 313 | if isTTY() { |
| 314 | t.Skip("Test requires non-TTY mode to validate fallback behavior") |
| 315 | } |
| 316 | |
| 317 | bar := NewProgressBar(1024 * 1024) // 1MB total |
| 318 | output := bar.Update(512 * 1024) // 512KB downloaded |
| 319 | |
| 320 | // Should produce something like: "50% (512.0KB/1.0MB)" |
| 321 | assert.Contains(t, output, "50%", "Should show percentage") |
| 322 | assert.Contains(t, output, "512.0KB", "Should show current size") |
| 323 | assert.Contains(t, output, "1.0MB", "Should show total size") |
| 324 | assert.Contains(t, output, "(", "Should have opening parenthesis") |
| 325 | assert.Contains(t, output, ")", "Should have closing parenthesis") |
| 326 | assert.Contains(t, output, "/", "Should have separator") |
| 327 | }) |
| 328 | } |
| 329 | |
| 330 | func TestProgressBarModeSelection(t *testing.T) { |
| 331 | t.Run("determinate mode has total and not indeterminate", func(t *testing.T) { |
nothing calls this directly
no test coverage detected