Make dashboard updateable
This commit is contained in:
@@ -19,7 +19,8 @@ func TestLoadConfigUsesDefaultsWhenOptionalFileIsMissing(t *testing.T) {
|
||||
got.RefreshInterval.Duration != want.RefreshInterval.Duration ||
|
||||
got.Paths.Scroll != want.Paths.Scroll ||
|
||||
got.Display.FoldResolved != want.Display.FoldResolved ||
|
||||
got.Display.CompactReviews != want.Display.CompactReviews {
|
||||
got.Display.CompactReviews != want.Display.CompactReviews ||
|
||||
got.Editing.Mode != "vim" {
|
||||
t.Fatalf("defaults = %#v, want %#v", got, want)
|
||||
}
|
||||
}
|
||||
@@ -52,6 +53,9 @@ within_status = "timestamp"
|
||||
enabled = false
|
||||
max_age = "48h"
|
||||
directory = "/tmp/gh-threads-cache"
|
||||
|
||||
[editing]
|
||||
mode = "standard"
|
||||
`
|
||||
if err := os.WriteFile(path, []byte(content), 0o600); err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -71,7 +75,8 @@ directory = "/tmp/gh-threads-cache"
|
||||
!got.Paths.Scroll || got.Paths.ScrollInterval.Duration != 125*time.Millisecond ||
|
||||
strings.Join(got.Threads.StatusOrder, ",") != "resolved,unresolved,outdated" ||
|
||||
got.Threads.WithinStatus != "timestamp" || got.Cache.Enabled ||
|
||||
got.Cache.MaxAge.Duration != 48*time.Hour || got.Cache.Directory != "/tmp/gh-threads-cache" {
|
||||
got.Cache.MaxAge.Duration != 48*time.Hour || got.Cache.Directory != "/tmp/gh-threads-cache" ||
|
||||
got.Editing.Mode != "standard" {
|
||||
t.Fatalf("config = %#v", got)
|
||||
}
|
||||
}
|
||||
@@ -164,3 +169,11 @@ func TestValidateConfigRejectsInvalidDashboardMode(t *testing.T) {
|
||||
t.Fatal("unknown dashboard mode was accepted")
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidateConfigRejectsInvalidEditorMode(t *testing.T) {
|
||||
config := defaultConfig()
|
||||
config.Editing.Mode = "emacs"
|
||||
if err := validateConfig(config); err == nil {
|
||||
t.Fatal("unknown editor mode was accepted")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user