(t *testing.T)
| 11 | ) |
| 12 | |
| 13 | func TestNewProgressBar(t *testing.T) { |
| 14 | t.Run("creates progress bar successfully", func(t *testing.T) { |
| 15 | bar := NewProgressBar(1024) |
| 16 | |
| 17 | require.NotNil(t, bar, "NewProgressBar should not return nil") |
| 18 | assert.Equal(t, int64(1024), bar.total, "Total should be set correctly") |
| 19 | assert.Equal(t, int64(0), bar.current, "Current should start at 0") |
| 20 | require.NotNil(t, bar.progress, "Progress model should be initialized") |
| 21 | }) |
| 22 | |
| 23 | t.Run("creates progress bar with zero total", func(t *testing.T) { |
| 24 | bar := NewProgressBar(0) |
| 25 | |
| 26 | require.NotNil(t, bar, "NewProgressBar should not return nil even with zero total") |
| 27 | assert.Equal(t, int64(0), bar.total, "Total should be 0") |
| 28 | }) |
| 29 | |
| 30 | t.Run("creates progress bar with large total", func(t *testing.T) { |
| 31 | largeSize := int64(10 * 1024 * 1024 * 1024) // 10GB |
| 32 | bar := NewProgressBar(largeSize) |
| 33 | |
| 34 | require.NotNil(t, bar, "NewProgressBar should handle large sizes") |
| 35 | assert.Equal(t, largeSize, bar.total, "Total should handle large values") |
| 36 | }) |
| 37 | } |
| 38 | |
| 39 | func TestProgressBarUpdate(t *testing.T) { |
| 40 | tests := []struct { |
nothing calls this directly
no test coverage detected