diff --git a/pkg/mux/screen/replay/replay_test.go b/pkg/mux/screen/replay/replay_test.go index 35b8d818..fddea06d 100644 --- a/pkg/mux/screen/replay/replay_test.go +++ b/pkg/mux/screen/replay/replay_test.go @@ -58,7 +58,17 @@ func createTest(events []sessions.Event) (*Replay, func(msgs ...interface{})) { m, cmd = m.Update(realMsg) m.View(tty.New(geom.DEFAULT_SIZE)) for cmd != nil { - m, cmd = m.Update(cmd()) + msg := cmd() + + switch msg := msg.(type) { + case tea.BatchMsg: + for _, cmd := range msg { + m, _ = m.Update(cmd()) + } + cmd = nil + default: + m, cmd = m.Update(msg) + } m.View(tty.New(geom.DEFAULT_SIZE)) } } @@ -83,6 +93,7 @@ func TestSearch(t *testing.T) { ) r, i := createTest(s.Events()) + r.searchProgress = nil i(ActionBeginning, ActionSearchForward, "bar", "enter") require.Equal(t, 3, len(r.matches)) require.Equal(t, 2, r.location.Index) diff --git a/pkg/mux/screen/replay/search.go b/pkg/mux/screen/replay/search.go index 77252217..db7ff0a4 100644 --- a/pkg/mux/screen/replay/search.go +++ b/pkg/mux/screen/replay/search.go @@ -87,6 +87,10 @@ type progressEvent struct { } func (r *Replay) waitProgress() tea.Cmd { + if r.searchProgress == nil { + return nil + } + return func() tea.Msg { return progressEvent{ value: <-r.searchProgress, diff --git a/pkg/sessions/search/search_test.go b/pkg/sessions/search/search_test.go index 8021fe75..74da621e 100644 --- a/pkg/sessions/search/search_test.go +++ b/pkg/sessions/search/search_test.go @@ -29,6 +29,7 @@ func TestBasic(t *testing.T) { "baz", ), "^bar", + nil, ) require.Equal(t, 1, len(results)) require.Equal(t, SearchResult{