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

Function TestConversation

lib/screentracker/pty_conversation_test.go:152–213  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

150}
151
152func TestConversation(t *testing.T) {
153 changing := st.ConversationStatusChanging
154 stable := st.ConversationStatusStable
155 initializing := st.ConversationStatusInitializing
156
157 statusTest(t, statusTestParams{
158 cfg: st.PTYConversationConfig{
159 SnapshotInterval: 1 * time.Second,
160 ScreenStabilityLength: 2 * time.Second,
161 // stability threshold: 3
162 AgentIO: &testAgent{
163 screen: "1",
164 },
165 },
166 steps: []statusTestStep{
167 {snapshot: "1", status: initializing},
168 {snapshot: "1", status: initializing},
169 {snapshot: "1", status: stable},
170 {snapshot: "1", status: stable},
171 {snapshot: "2", status: changing},
172 },
173 })
174
175 statusTest(t, statusTestParams{
176 cfg: st.PTYConversationConfig{
177 SnapshotInterval: 2 * time.Second,
178 ScreenStabilityLength: 3 * time.Second,
179 // stability threshold: 3
180 },
181 steps: []statusTestStep{
182 {snapshot: "1", status: initializing},
183 {snapshot: "1", status: initializing},
184 {snapshot: "1", status: stable},
185 {snapshot: "1", status: stable},
186 {snapshot: "2", status: changing},
187 {snapshot: "2", status: changing},
188 {snapshot: "2", status: stable},
189 {snapshot: "2", status: stable},
190 {snapshot: "2", status: stable},
191 },
192 })
193
194 statusTest(t, statusTestParams{
195 cfg: st.PTYConversationConfig{
196 SnapshotInterval: 6 * time.Second,
197 ScreenStabilityLength: 14 * time.Second,
198 // stability threshold: 4
199 },
200 steps: []statusTestStep{
201 {snapshot: "1", status: initializing},
202 {snapshot: "1", status: initializing},
203 {snapshot: "1", status: initializing},
204 {snapshot: "1", status: stable},
205 {snapshot: "1", status: stable},
206 {snapshot: "1", status: stable},
207 {snapshot: "2", status: changing},
208 {snapshot: "2", status: changing},
209 {snapshot: "2", status: changing},

Callers

nothing calls this directly

Calls 1

statusTestFunction · 0.85

Tested by

no test coverage detected