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

Function Test_Send_RejectsWhitespace

x/acpio/acp_conversation_test.go:250–276  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

248}
249
250func Test_Send_RejectsWhitespace(t *testing.T) {
251 tests := []struct {
252 name string
253 content string
254 }{
255 {"leading space", " hello"},
256 {"trailing space", "hello "},
257 {"leading newline", "\nhello"},
258 {"trailing newline", "hello\n"},
259 {"both sides", " hello "},
260 {"newlines both sides", "\nhello\n"},
261 {"leading tab", "\thello"},
262 {"trailing tab", "hello\t"},
263 }
264
265 for _, tt := range tests {
266 t.Run(tt.name, func(t *testing.T) {
267 mClock := quartz.NewMock(t)
268 mock := newMockAgentIO()
269 conv := acpio.NewACPConversation(context.Background(), mock, nil, nil, nil, mClock)
270
271 err := conv.Send(screentracker.MessagePartText{Content: tt.content})
272
273 assert.ErrorIs(t, err, screentracker.ErrMessageValidationWhitespace)
274 })
275 }
276}
277
278func Test_Send_RejectsDuplicateSend(t *testing.T) {
279 mClock := quartz.NewMock(t)

Callers

nothing calls this directly

Calls 3

SendMethod · 0.95
NewACPConversationFunction · 0.92
newMockAgentIOFunction · 0.85

Tested by

no test coverage detected