Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions pkg/console/golden_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,15 +325,6 @@ func nonTTYProgressBar(total int64) *ProgressBar {
return bar
}

// nonTTYIndeterminateProgressBar returns an indeterminate ProgressBar in non-TTY
// mode, ensuring tests always take the text-only branch and never call ViewAs on
// the bubbles model.
func nonTTYIndeterminateProgressBar() *ProgressBar {
bar := NewIndeterminateProgressBar()
bar.ttyCheck = func() bool { return false }
return bar
}

// TestGolden_ProgressBarNonTTY tests the deterministic non-TTY outputs of ProgressBar.Update.
// These cases are pure and side-effect-free, making them ideal for golden coverage.
// ttyCheck is overridden to always return false so the tests run unconditionally,
Expand All @@ -358,16 +349,6 @@ func TestGolden_ProgressBarNonTTY(t *testing.T) {
bar := nonTTYProgressBar(0)
golden.RequireEqual(t, []byte(bar.Update(0)))
})

t.Run("indeterminate_no_data", func(t *testing.T) {
bar := nonTTYIndeterminateProgressBar()
golden.RequireEqual(t, []byte(bar.Update(0)))
})

t.Run("indeterminate_with_data", func(t *testing.T) {
bar := nonTTYIndeterminateProgressBar()
golden.RequireEqual(t, []byte(bar.Update(512*1024*1024)))
})
}

// TestGolden_InfoSection tests info section rendering
Expand Down
18 changes: 0 additions & 18 deletions pkg/console/progress.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,24 +70,6 @@ func NewProgressBar(total int64) *ProgressBar {
}
}

// NewIndeterminateProgressBar creates a new progress bar in indeterminate mode
// for use when the total size is not known. The progress bar automatically adapts
// to TTY/non-TTY environments.
func NewIndeterminateProgressBar() *ProgressBar {
progressLog.Printf("Creating indeterminate progress bar")
prog := progress.New(
progress.WithColors(styles.ColorPurple, styles.ColorInfo),
progress.WithScaled(true),
progress.WithWidth(40),
)
prog.EmptyColor = styles.ColorComment
return &ProgressBar{
progress: prog,
indeterminate: true,
ttyCheck: isTTY,
}
}

// Update updates the current progress and returns a formatted string
// In determinate mode:
// - TTY: Returns a visual progress bar with gradient and percentage
Expand Down
Loading