Add configuration

This commit is contained in:
2026-07-28 09:35:15 +02:00
parent 547cd123da
commit 80f24bcfa8
12 changed files with 629 additions and 41 deletions

View File

@@ -44,6 +44,20 @@ func TestResolvedThreadsStartFolded(t *testing.T) {
}
}
func TestResolvedThreadFoldingCanBeDisabled(t *testing.T) {
settings := defaultAppSettings()
settings.FoldResolved = false
m := NewAppWithSettings(nil, "o", "r", false, 50, 10*time.Second, settings)
m.details = PRDetails{PullRequest: PullRequest{Number: 7}}
updated, _ := m.Update(detailsLoadedMsg{number: 7, details: PRDetails{
PullRequest: PullRequest{Number: 7},
Threads: []ReviewThread{{ID: "done", IsResolved: true}},
}})
if updated.(App).folded["done"] {
t.Fatal("resolved thread was folded despite configuration")
}
}
func TestResolvedThreadIconTakesPrecedenceOverOutdated(t *testing.T) {
m := NewApp(nil, "o", "r", false, 50, 10*time.Second)
m.details = PRDetails{Threads: []ReviewThread{{
@@ -181,6 +195,36 @@ func TestTruncatePathPreservesFilename(t *testing.T) {
}
}
func TestConfiguredPathScrollingAdvances(t *testing.T) {
settings := defaultAppSettings()
settings.PathScroll = true
settings.PathScrollInterval = 100 * time.Millisecond
m := NewAppWithSettings(nil, "o", "r", false, 50, 10*time.Second, settings)
m.screen = threadScreen
updated, _ := m.Update(pathTickMsg(time.Now()))
if got := updated.(App).pathScrollStep; got != 1 {
t.Fatalf("path scroll step = %d, want 1", got)
}
path := "internal/review/threads/important_filename.go"
if beginning := scrollingPath(path, 18, 0); !strings.HasPrefix(beginning, "internal/") {
t.Fatalf("scroll beginning = %q", beginning)
}
if end := scrollingPath(path, 18, 1000); ansi.StringWidth(end) != 18 {
t.Fatalf("scroll output has width %d", ansi.StringWidth(end))
}
}
func TestConfiguredThreadListWidth(t *testing.T) {
settings := defaultAppSettings()
settings.ThreadListWidthPercent = 50
m := NewAppWithSettings(nil, "o", "r", false, 50, 10*time.Second, settings)
m.width = 120
if got := m.threadListWidth(); got != 60 {
t.Fatalf("thread list width = %d, want 60", got)
}
}
func TestFuzzyFileSearchRanksAndFiltersPaths(t *testing.T) {
m := NewApp(nil, "o", "r", false, 50, 10*time.Second)
m.searchQuery = "svcusr"