MCPcopy Create free account
hub / github.com/basecamp/hey-cli / TestJournalViewSubnavLeftRight

Function TestJournalViewSubnavLeftRight

internal/tui/journal_test.go:121–146  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

119 if len(v.list.entries) != 0 || !v.requests.loading {
120 t.Fatalf("stale page changed feed: entries:%d loading:%v", len(v.list.entries), v.requests.loading)
121 }
122}
123
124func TestJournalScrollNearBottomLoadsMore(t *testing.T) {
125 v := loadedJournalView(journalEntries(10))
126 v.nextPage = "next"
127 v.Resize(80, 6)
128 for range 6 {
129 v.HandleContentKey(keyPress("down"))
130 }
131 if !v.loadingMore {
132 t.Fatal("scrolling near the bottom should load another page")
133 }
134}
135
136func TestJournalSearchAndClear(t *testing.T) {
137 v := loadedJournalView(journalEntries(1))
138 if cmd := v.HandleContentKey(keyPress("/")); cmd == nil || v.prompt == nil {
139 t.Fatal("/ should open and focus search")
140 }
141 v.prompt.input.SetValue("quarterly planning")
142 cmd := v.HandleContentKey(keyPress("enter"))
143 if cmd == nil || v.prompt != nil || v.query != "quarterly planning" || v.requests.kind != journalRequestFeed {
144 t.Fatalf("search state = cmd:%v prompt:%v query:%q kind:%v", cmd != nil, v.prompt != nil, v.query, v.requests.kind)
145 }
146 v.Update(journalPageLoadedMsg{requestResult: currentJournalResult(v)})
147 if got := stripANSI(v.View()); !strings.Contains(got, "Search: quarterly planning · 0 results") {
148 t.Fatalf("search empty state = %q", got)
149 }

Callers

nothing calls this directly

Calls 6

newJournalViewFunction · 0.85
testVCFunction · 0.85
InitMethod · 0.65
SubnavLeftMethod · 0.65
SubnavRightMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected