@@ -41,7 +41,7 @@ func TestClient_QueryThreads(t *testing.T) {
41
41
42
42
thread := resp .Threads [0 ]
43
43
assertThreadData (t , thread , ch , parentMsg , replyMsg )
44
- assertThreadParticipants (t , thread , ch . CreatedBy . ID )
44
+ assertThreadParticipants (t , thread , membersID [ 0 ] )
45
45
46
46
assert .Empty (t , resp .PagerResponse )
47
47
})
@@ -51,13 +51,13 @@ func TestClient_QueryThreads(t *testing.T) {
51
51
limit := 1
52
52
53
53
// Create a second thread
54
- parentMsg2 , err := ch .SendMessage (ctx , & Message {Text : "Parent message for thread 2" }, ch . CreatedBy . ID )
54
+ parentMsg2 , err := ch .SendMessage (ctx , & Message {Text : "Parent message for thread 2" }, membersID [ 0 ] )
55
55
require .NoError (t , err , "send second parent message" )
56
56
57
57
replyMsg2 , err := ch .SendMessage (ctx , & Message {
58
58
Text : "Reply message 2" ,
59
59
ParentID : parentMsg2 .Message .ID ,
60
- }, ch . CreatedBy . ID )
60
+ }, membersID [ 0 ] )
61
61
require .NoError (t , err , "send second reply message" )
62
62
63
63
// First page query
@@ -86,7 +86,7 @@ func TestClient_QueryThreads(t *testing.T) {
86
86
87
87
thread := resp .Threads [0 ]
88
88
assertThreadData (t , thread , ch , parentMsg1 , replyMsg1 )
89
- assertThreadParticipants (t , thread , ch . CreatedBy . ID )
89
+ assertThreadParticipants (t , thread , membersID [ 0 ] )
90
90
91
91
// Second page query
92
92
query2 := & QueryThreadsRequest {
@@ -115,7 +115,7 @@ func TestClient_QueryThreads(t *testing.T) {
115
115
116
116
thread = resp .Threads [0 ]
117
117
assertThreadData (t , thread , ch , parentMsg2 , replyMsg2 )
118
- assertThreadParticipants (t , thread , ch . CreatedBy . ID )
118
+ assertThreadParticipants (t , thread , membersID [ 0 ] )
119
119
})
120
120
}
121
121
@@ -125,14 +125,14 @@ func testThreadSetup(t *testing.T, c *Client, numMembers int) ([]string, *Channe
125
125
ch := initChannel (t , c , membersID ... )
126
126
127
127
// Create a parent message
128
- parentMsg , err := ch .SendMessage (context .Background (), & Message {Text : "Parent message for thread" }, ch . CreatedBy . ID )
128
+ parentMsg , err := ch .SendMessage (context .Background (), & Message {Text : "Parent message for thread" }, membersID [ 0 ] )
129
129
require .NoError (t , err , "send parent message" )
130
130
131
131
// Create a thread by sending a reply
132
132
replyMsg , err := ch .SendMessage (context .Background (), & Message {
133
133
Text : "Reply message" ,
134
134
ParentID : parentMsg .Message .ID ,
135
- }, ch . CreatedBy . ID )
135
+ }, membersID [ 0 ] )
136
136
require .NoError (t , err , "send reply message" )
137
137
138
138
return membersID , ch , parentMsg , replyMsg
@@ -142,7 +142,7 @@ func testThreadSetup(t *testing.T, c *Client, numMembers int) ([]string, *Channe
142
142
func assertThreadData (t * testing.T , thread ThreadResponse , ch * Channel , parentMsg , replyMsg * MessageResponse ) {
143
143
assert .Equal (t , ch .CID , thread .ChannelCID , "channel CID should match" )
144
144
assert .Equal (t , parentMsg .Message .ID , thread .ParentMessageID , "parent message ID should match" )
145
- assert .Equal (t , ch . CreatedBy .ID , thread .CreatedByUserID , "created by user ID should match" )
145
+ assert .Equal (t , replyMsg . Message . User .ID , thread .CreatedByUserID , "created by user ID should match" )
146
146
assert .Equal (t , 1 , thread .ReplyCount , "reply count should be 1" )
147
147
assert .Equal (t , 1 , thread .ParticipantCount , "participant count should be 1" )
148
148
assert .Equal (t , parentMsg .Message .Text , thread .Title , "title should not be empty" )
0 commit comments