@@ -1021,66 +1021,6 @@ def loop_times(times)
10211021 end
10221022 end
10231023
1024- describe '#query_threads' do
1025- before ( :all ) do
1026- # Create a dedicated random user for this block
1027- @thread_test_user = { id : SecureRandom . uuid }
1028- @client . upsert_users ( [ @thread_test_user ] )
1029-
1030- # Create a channel and send a message to create a thread
1031- @thread_channel = @client . channel ( 'messaging' , channel_id : SecureRandom . uuid , data : { test : true } )
1032- @thread_channel . create ( @thread_test_user [ :id ] )
1033-
1034- # Send a message to create a thread
1035- @thread_message = @thread_channel . send_message ( { text : 'Thread parent message' } , @thread_test_user [ :id ] )
1036-
1037- # Send a reply to create a thread
1038- @thread_channel . send_message ( { text : 'Thread reply' , parent_id : @thread_message [ 'message' ] [ 'id' ] } , @thread_test_user [ :id ] )
1039- end
1040-
1041- after ( :all ) do
1042- @thread_channel . delete
1043- @client . delete_user ( @thread_test_user [ :id ] )
1044- end
1045-
1046- it 'queries threads with filter' do
1047- filter = {
1048- 'created_by_user_id' => { '$eq' => @thread_test_user [ :id ] }
1049- }
1050-
1051- response = @client . query_threads ( filter , user_id : @thread_test_user [ :id ] )
1052-
1053- expect ( response ) . to include 'threads'
1054- expect ( response [ 'threads' ] . length ) . to be >= 1
1055- end
1056-
1057- it 'queries threads with sort' do
1058- sort = {
1059- 'created_at' => -1
1060- }
1061-
1062- response = @client . query_threads ( { } , sort : sort , user_id : @thread_test_user [ :id ] )
1063-
1064- expect ( response ) . to include 'threads'
1065- expect ( response [ 'threads' ] . length ) . to be >= 1
1066- end
1067-
1068- it 'queries threads with both filter and sort' do
1069- filter = {
1070- 'created_by_user_id' => { '$eq' => @thread_test_user [ :id ] }
1071- }
1072-
1073- sort = {
1074- 'created_at' => -1
1075- }
1076-
1077- response = @client . query_threads ( filter , sort : sort , user_id : @thread_test_user [ :id ] )
1078-
1079- expect ( response ) . to include 'threads'
1080- expect ( response [ 'threads' ] . length ) . to be >= 1
1081- end
1082- end
1083-
10841024 describe 'reminders' do
10851025 before do
10861026 @client = StreamChat ::Client . from_env
0 commit comments