@@ -949,16 +949,11 @@ func ExampleChannel_Query() {
949949func TestChannel_MessageCount_DefaultEnabled (t * testing.T ) {
950950 c := initClient (t )
951951 ctx := context .Background ()
952-
953- _ , err := c .UpdateChannelType (ctx , "team" , map [string ]interface {}{"count_messages" : true })
954- require .NoError (t , err )
955-
956- time .Sleep (500 * time .Millisecond )
957- ch := initChannel (t , c )
952+ ch := initChannelWithType (t , c , "message_counting" )
958953
959954 // Send a single message to the channel
960955 user := randomUser (t , c )
961- _ , err = ch .SendMessage (ctx , & Message {Text : "hello world" }, user .ID )
956+ _ , err : = ch .SendMessage (ctx , & Message {Text : "hello world" }, user .ID )
962957 require .NoError (t , err , "send message" )
963958
964959 // Refresh the channel state to get the updated message_count field
@@ -967,10 +962,6 @@ func TestChannel_MessageCount_DefaultEnabled(t *testing.T) {
967962 // message_count should be present and equal to 1
968963 require .NotNil (t , ch .MessageCount , "message_count should not be nil when CountMessages is enabled" )
969964 assert .Equal (t , 1 , * ch .MessageCount )
970-
971- // Clean up: reset the CountMessages feature to false
972- _ , err = c .UpdateChannelType (ctx , "team" , map [string ]interface {}{"count_messages" : false })
973- require .NoError (t , err )
974965}
975966
976967// TestChannel_MessageCount_Disabled verifies that message_count is omitted when the
0 commit comments