summaryrefslogtreecommitdiff
path: root/internal/askcli/command_watch_test.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-06-18 08:05:32 +0300
committerPaul Buetow <paul@buetow.org>2026-06-18 08:05:32 +0300
commita80ad2b4691d0df63f68c6977ee18444e7bb752f (patch)
tree6edc47fcc3c929856826432cf3df3394a14934e8 /internal/askcli/command_watch_test.go
parent4ffb22e7f69f1c9c79b095d4e60bad3d97aac55b (diff)
ik0 replace remaining test seams with DI
Diffstat (limited to 'internal/askcli/command_watch_test.go')
-rw-r--r--internal/askcli/command_watch_test.go19
1 files changed, 2 insertions, 17 deletions
diff --git a/internal/askcli/command_watch_test.go b/internal/askcli/command_watch_test.go
index 7618060..d742a4b 100644
--- a/internal/askcli/command_watch_test.go
+++ b/internal/askcli/command_watch_test.go
@@ -5,7 +5,6 @@ import (
"context"
"errors"
"io"
- "path/filepath"
"reflect"
"strings"
"testing"
@@ -100,14 +99,7 @@ func TestHandleWatch_DrawsStderrOnNonZero(t *testing.T) {
func TestHandleWatch_DefaultsToListAndRedrawsOnChange(t *testing.T) {
dir := t.TempDir()
- oldRoot := taskAliasCacheRoot
- oldNow := nowTaskAliasCache
- taskAliasCacheRoot = func() (string, error) { return filepath.Join(dir, "hexai"), nil }
- nowTaskAliasCache = func() time.Time { return time.Date(2026, 5, 26, 12, 0, 0, 0, time.UTC) }
- t.Cleanup(func() {
- taskAliasCacheRoot = oldRoot
- nowTaskAliasCache = oldNow
- })
+ t.Setenv("XDG_CACHE_HOME", dir)
ticks := make(chan time.Time, 1)
ticks <- time.Now()
@@ -157,14 +149,7 @@ func TestHandleWatch_DefaultsToListAndRedrawsOnChange(t *testing.T) {
func TestHandleWatch_DoesNotRedrawUnchangedOutput(t *testing.T) {
dir := t.TempDir()
- oldRoot := taskAliasCacheRoot
- oldNow := nowTaskAliasCache
- taskAliasCacheRoot = func() (string, error) { return filepath.Join(dir, "hexai"), nil }
- nowTaskAliasCache = func() time.Time { return time.Date(2026, 5, 26, 12, 0, 0, 0, time.UTC) }
- t.Cleanup(func() {
- taskAliasCacheRoot = oldRoot
- nowTaskAliasCache = oldNow
- })
+ t.Setenv("XDG_CACHE_HOME", dir)
ticks := make(chan time.Time, 1)
ticks <- time.Now()