Add ordering for threads
This commit is contained in:
@@ -40,6 +40,10 @@ thread_list_width_percent = 45
|
||||
[paths]
|
||||
scroll = true
|
||||
scroll_interval = "125ms"
|
||||
|
||||
[threads]
|
||||
status_order = ["resolved", "unresolved", "outdated"]
|
||||
within_status = "timestamp"
|
||||
`
|
||||
if err := os.WriteFile(path, []byte(content), 0o600); err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -54,7 +58,9 @@ scroll_interval = "125ms"
|
||||
if got.Theme != "light" || got.RefreshInterval.Duration != 25*time.Second ||
|
||||
got.Repository != "owner/repo" || !got.ShowAll || got.Limit != 75 ||
|
||||
got.Display.FoldResolved || got.Display.ThreadListWidthPercent != 45 ||
|
||||
!got.Paths.Scroll || got.Paths.ScrollInterval.Duration != 125*time.Millisecond {
|
||||
!got.Paths.Scroll || got.Paths.ScrollInterval.Duration != 125*time.Millisecond ||
|
||||
strings.Join(got.Threads.StatusOrder, ",") != "resolved,unresolved,outdated" ||
|
||||
got.Threads.WithinStatus != "timestamp" {
|
||||
t.Fatalf("config = %#v", got)
|
||||
}
|
||||
}
|
||||
@@ -126,3 +132,16 @@ func TestValidateConfigRejectsUnsafeAnimationRate(t *testing.T) {
|
||||
t.Fatal("unsafe path scrolling interval was accepted")
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidateConfigRejectsInvalidThreadOrdering(t *testing.T) {
|
||||
config := defaultConfig()
|
||||
config.Threads.StatusOrder = []string{"unresolved", "resolved", "resolved"}
|
||||
if err := validateConfig(config); err == nil {
|
||||
t.Fatal("duplicate thread status was accepted")
|
||||
}
|
||||
config = defaultConfig()
|
||||
config.Threads.WithinStatus = "author"
|
||||
if err := validateConfig(config); err == nil {
|
||||
t.Fatal("unknown within-status ordering was accepted")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user