@@ -232,7 +232,7 @@ func TestExecute_ChatMessagesList_Text_Unread(t *testing.T) {
232232
233233 out := captureStdout (t , func () {
234234 errOut := captureStderr (t , func () {
235- if err := Execute ([]string {"--account" , "a@b.com" , "chat" , "messages" , "list" , "spaces/aaa" , "--unread" }); err != nil {
235+ if err := Execute ([]string {"--account" , "a@b.com" , "chat" , "messages" , "list" , "spaces/aaa" , "--unread" , "--thread" , "t1" }); err != nil {
236236 t .Fatalf ("Execute: %v" , err )
237237 }
238238 })
@@ -246,13 +246,17 @@ func TestExecute_ChatMessagesList_Text_Unread(t *testing.T) {
246246 if ! strings .Contains (gotFilter , "createTime > \" 2025-01-01T00:00:00Z\" " ) {
247247 t .Fatalf ("unexpected filter: %q" , gotFilter )
248248 }
249+ if ! strings .Contains (gotFilter , "thread.name = \" spaces/aaa/threads/t1\" " ) {
250+ t .Fatalf ("unexpected thread filter: %q" , gotFilter )
251+ }
249252}
250253
251254func TestExecute_ChatMessagesSend_JSON (t * testing.T ) {
252255 origNew := newChatService
253256 t .Cleanup (func () { newChatService = origNew })
254257
255258 var gotText string
259+ var gotThread string
256260
257261 srv := httptest .NewServer (http .HandlerFunc (func (w http.ResponseWriter , r * http.Request ) {
258262 if ! (r .Method == http .MethodPost && strings .Contains (r .URL .Path , "/messages" )) {
@@ -262,6 +266,9 @@ func TestExecute_ChatMessagesSend_JSON(t *testing.T) {
262266 var body map [string ]any
263267 _ = json .NewDecoder (r .Body ).Decode (& body )
264268 gotText , _ = body ["text" ].(string )
269+ if thread , ok := body ["thread" ].(map [string ]any ); ok {
270+ gotThread , _ = thread ["name" ].(string )
271+ }
265272
266273 w .Header ().Set ("Content-Type" , "application/json" )
267274 _ = json .NewEncoder (w ).Encode (map [string ]any {
@@ -282,14 +289,17 @@ func TestExecute_ChatMessagesSend_JSON(t *testing.T) {
282289
283290 out := captureStdout (t , func () {
284291 _ = captureStderr (t , func () {
285- if err := Execute ([]string {"--json" , "--account" , "a@b.com" , "chat" , "messages" , "send" , "spaces/aaa" , "--text" , "hello" }); err != nil {
292+ if err := Execute ([]string {"--json" , "--account" , "a@b.com" , "chat" , "messages" , "send" , "spaces/aaa" , "--text" , "hello" , "--thread" , "t1" }); err != nil {
286293 t .Fatalf ("Execute: %v" , err )
287294 }
288295 })
289296 })
290297 if gotText != "hello" {
291298 t .Fatalf ("unexpected text: %q" , gotText )
292299 }
300+ if gotThread != "spaces/aaa/threads/t1" {
301+ t .Fatalf ("unexpected thread: %q" , gotThread )
302+ }
293303 if ! strings .Contains (out , "spaces/aaa/messages/msg2" ) {
294304 t .Fatalf ("unexpected out=%q" , out )
295305 }
0 commit comments