Change name and prepare for push
This commit is contained in:
@@ -52,7 +52,7 @@ within_status = "timestamp"
|
||||
[cache]
|
||||
enabled = false
|
||||
max_age = "48h"
|
||||
directory = "/tmp/gh-threads-cache"
|
||||
directory = "/tmp/diple-cache"
|
||||
|
||||
[editing]
|
||||
mode = "standard"
|
||||
@@ -79,7 +79,7 @@ up = ["ctrl+k"]
|
||||
!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/diple-cache" ||
|
||||
got.Editing.Mode != "standard" ||
|
||||
strings.Join(got.KeyBindings.Navigation.Down, ",") != "ctrl+j" ||
|
||||
strings.Join(got.KeyBindings.Navigation.Up, ",") != "ctrl+k" {
|
||||
@@ -149,20 +149,33 @@ func TestLoadConfigRejectsUnknownSettings(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestConfigPathHonorsEnvironmentOverride(t *testing.T) {
|
||||
t.Setenv("GH_THREADS_CONFIG", "/tmp/custom-gh-threads.toml")
|
||||
t.Setenv("DIPLE_CONFIG", "/tmp/custom-diple.toml")
|
||||
t.Setenv("GH_THREADS_CONFIG", "")
|
||||
got, err := configPath()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if got != "/tmp/custom-gh-threads.toml" {
|
||||
if got != "/tmp/custom-diple.toml" {
|
||||
t.Fatalf("config path = %q", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestConfigPathHonorsLegacyEnvironmentOverride(t *testing.T) {
|
||||
t.Setenv("DIPLE_CONFIG", "")
|
||||
t.Setenv("GH_THREADS_CONFIG", "/tmp/legacy-gh-threads.toml")
|
||||
got, err := configPath()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if got != "/tmp/legacy-gh-threads.toml" {
|
||||
t.Fatalf("legacy config path = %q", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestExistingConfigPathFallsBackToDotConfig(t *testing.T) {
|
||||
root := t.TempDir()
|
||||
preferred := filepath.Join(root, "Library", "Application Support", "gh-threads", "config.toml")
|
||||
fallback := filepath.Join(root, ".config", "gh-threads", "config.toml")
|
||||
preferred := filepath.Join(root, "Library", "Application Support", "diple", "config.toml")
|
||||
fallback := filepath.Join(root, ".config", "diple", "config.toml")
|
||||
if err := os.MkdirAll(filepath.Dir(fallback), 0o700); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -184,14 +197,30 @@ func TestExistingConfigPathFallsBackToDotConfig(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestFirstExistingConfigPathFallsBackToLegacyName(t *testing.T) {
|
||||
root := t.TempDir()
|
||||
current := filepath.Join(root, "diple", "config.toml")
|
||||
legacy := filepath.Join(root, "gh-threads", "config.toml")
|
||||
if err := os.MkdirAll(filepath.Dir(legacy), 0o700); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := os.WriteFile(legacy, []byte("theme = \"dark\"\n"), 0o600); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if got := firstExistingOrDefault(current, legacy); got != legacy {
|
||||
t.Fatalf("migration config path = %q, want %q", got, legacy)
|
||||
}
|
||||
}
|
||||
|
||||
func TestConfigPathHonorsXDGConfigHome(t *testing.T) {
|
||||
t.Setenv("GH_THREADS_CONFIG", "")
|
||||
t.Setenv("DIPLE_CONFIG", "")
|
||||
t.Setenv("XDG_CONFIG_HOME", "/tmp/xdg-config")
|
||||
got, err := configPath()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
want := "/tmp/xdg-config/gh-threads/config.toml"
|
||||
want := "/tmp/xdg-config/diple/config.toml"
|
||||
if got != want {
|
||||
t.Fatalf("config path = %q, want %q", got, want)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user