test: isolate timestamp settings tests from terminal environment
- commit
- 81f384a17c710aea38411129a88012ec5fc9282a
- author
- patriceckhart · · 2026-09-22 14:26 UTC
- parent
- 40a7947
- signature
- unsigned
- refs
- tag: v0.3.86
1 file · +6 -2
M packages/agent/modes/chat_timestamps_test.go +6 -2
| @@ -35,8 +35,10 @@ func (s *timestampSettingsTestStore) SetChatTimestampDate(mode string) error { | |||
| 35 | 35 | } | |
| 36 | 36 | ||
| 37 | 37 | func TestChatTimestampDateSetting(t *testing.T) { | |
| 38 | + | // Exercise repainting independently of the developer's terminal environment. | |
| 39 | + | t.Setenv("TERM_PROGRAM", "") | |
| 38 | 40 | store := ×tampSettingsTestStore{} | |
| 39 | - | i := NewInteractive(InteractiveConfig{SettingsStore: store}) | |
| 41 | + | i := NewInteractive(InteractiveConfig{Terminal: &cleanupTestTerminal{}, SettingsStore: store}) | |
| 40 | 42 | item := i.chatTimestampDateSetting() | |
| 41 | 43 | if item.options[item.choice].value != "day_start" { | |
| 42 | 44 | t.Fatal("incorrect date default") | |
| @@ -62,8 +64,10 @@ func TestChatTimestampDateSetting(t *testing.T) { | |||
| 62 | 64 | } | |
| 63 | 65 | ||
| 64 | 66 | func TestChatTimestampSettings(t *testing.T) { | |
| 67 | + | // Exercise repainting independently of the developer's terminal environment. | |
| 68 | + | t.Setenv("TERM_PROGRAM", "") | |
| 65 | 69 | store := ×tampSettingsTestStore{} | |
| 66 | - | i := NewInteractive(InteractiveConfig{SettingsStore: store}) | |
| 70 | + | i := NewInteractive(InteractiveConfig{Terminal: &cleanupTestTerminal{}, SettingsStore: store}) | |
| 67 | 71 | if i.view.ChatTimestamps || tui.ChatTimestampInterval(i.view.ChatTimestampIntervalMinutes) != 0 { | |
| 68 | 72 | t.Fatal("incorrect startup defaults") | |
| 69 | 73 | } | |
| @@ -35,8 +35,10 @@ func (s *timestampSettingsTestStore) SetChatTimestampDate(mode string) error { | |||||
| 35 | } | 35 | } | ||
| 36 | 36 | ||||
| 37 | func TestChatTimestampDateSetting(t *testing.T) { | 37 | func TestChatTimestampDateSetting(t *testing.T) { | ||
| 38 | + | // Exercise repainting independently of the developer's terminal environment. | |||
| 39 | + | t.Setenv("TERM_PROGRAM", "") | |||
| 38 | store := ×tampSettingsTestStore{} | 40 | store := ×tampSettingsTestStore{} | ||
| 39 | - | i := NewInteractive(InteractiveConfig{SettingsStore: store}) | 41 | + | i := NewInteractive(InteractiveConfig{Terminal: &cleanupTestTerminal{}, SettingsStore: store}) |
| 40 | item := i.chatTimestampDateSetting() | 42 | item := i.chatTimestampDateSetting() | ||
| 41 | if item.options[item.choice].value != "day_start" { | 43 | if item.options[item.choice].value != "day_start" { | ||
| 42 | t.Fatal("incorrect date default") | 44 | t.Fatal("incorrect date default") | ||
| @@ -62,8 +64,10 @@ func TestChatTimestampDateSetting(t *testing.T) { | |||||
| 62 | } | 64 | } | ||
| 63 | 65 | ||||
| 64 | func TestChatTimestampSettings(t *testing.T) { | 66 | func TestChatTimestampSettings(t *testing.T) { | ||
| 67 | + | // Exercise repainting independently of the developer's terminal environment. | |||
| 68 | + | t.Setenv("TERM_PROGRAM", "") | |||
| 65 | store := ×tampSettingsTestStore{} | 69 | store := ×tampSettingsTestStore{} | ||
| 66 | - | i := NewInteractive(InteractiveConfig{SettingsStore: store}) | 70 | + | i := NewInteractive(InteractiveConfig{Terminal: &cleanupTestTerminal{}, SettingsStore: store}) |
| 67 | if i.view.ChatTimestamps || tui.ChatTimestampInterval(i.view.ChatTimestampIntervalMinutes) != 0 { | 71 | if i.view.ChatTimestamps || tui.ChatTimestampInterval(i.view.ChatTimestampIntervalMinutes) != 0 { | ||
| 68 | t.Fatal("incorrect startup defaults") | 72 | t.Fatal("incorrect startup defaults") | ||
| 69 | } | 73 | } | ||