sendAndAdvance calls Send() in a goroutine and advances the mock clock until Send completes.
(ctx context.Context, t *testing.T, c *st.PTYConversation, mClock *quartz.Mock, parts ...st.MessagePart)
| 86 | // sendAndAdvance calls Send() in a goroutine and advances the mock clock until |
| 87 | // Send completes. |
| 88 | func sendAndAdvance(ctx context.Context, t *testing.T, c *st.PTYConversation, mClock *quartz.Mock, parts ...st.MessagePart) { |
| 89 | t.Helper() |
| 90 | errCh := make(chan error, 1) |
| 91 | go func() { |
| 92 | errCh <- c.Send(parts...) |
| 93 | }() |
| 94 | advanceUntil(ctx, t, mClock, func() bool { |
| 95 | select { |
| 96 | case err := <-errCh: |
| 97 | require.NoError(t, err) |
| 98 | return true |
| 99 | default: |
| 100 | return false |
| 101 | } |
| 102 | }) |
| 103 | } |
| 104 | |
| 105 | func assertMessages(t *testing.T, c *st.PTYConversation, expected []st.ConversationMessage) { |
| 106 | t.Helper() |
no test coverage detected