MCPcopy Create free account
hub / github.com/coder/agentapi / sendAndAdvance

Function sendAndAdvance

lib/screentracker/pty_conversation_test.go:88–103  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

86// sendAndAdvance calls Send() in a goroutine and advances the mock clock until
87// Send completes.
88func 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
105func assertMessages(t *testing.T, c *st.PTYConversation, expected []st.ConversationMessage) {
106 t.Helper()

Callers 1

TestMessagesFunction · 0.85

Calls 2

advanceUntilFunction · 0.85
SendMethod · 0.65

Tested by

no test coverage detected