MCPcopy Create free account
hub / github.com/github/gh-aw / TestNewProgressBar

Function TestNewProgressBar

pkg/console/progress_test.go:13–37  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

11)
12
13func 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
39func TestProgressBarUpdate(t *testing.T) {
40 tests := []struct {

Callers

nothing calls this directly

Calls 2

NewProgressBarFunction · 0.70
RunMethod · 0.45

Tested by

no test coverage detected