Skip to content

Commit 58b0246

Browse files
committed
Fix tests waiting for WS event
1 parent c8571ce commit 58b0246

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

Assets/Plugins/StreamChat/Tests/StatefulClient/ChannelsQueryFiltersTests.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,15 @@ private async Task When_query_channel_with_created_by_id_filter_expect_valid_res
108108
var channel1 = await CreateUniqueTempChannelAsync();
109109
var channel2 = await CreateUniqueTempChannelAsync();
110110
var channel3 = await CreateUniqueTempChannelAsync();
111+
var allChannels = new[] { channel1, channel2, channel3 };
111112

112113
var filters = new IFieldFilterRule[]
113114
{
114115
ChannelFilter.CreatedById.EqualsTo(Client.LocalUserData.User),
115116
};
116117

117-
var channels = (await Client.QueryChannelsAsync(filters, _sortByCreatedAtAscending)).ToArray();
118+
var channels = (await TryAsync(() => Client.QueryChannelsAsync(filters, _sortByCreatedAtAscending),
119+
channels => allChannels.All(channels.Contains))).ToArray();
118120
Assert.Contains(channel1, channels);
119121
Assert.Contains(channel2, channels);
120122
Assert.Contains(channel3, channels);
@@ -215,14 +217,14 @@ private async Task When_query_channel_by_created_at_filter_expect_valid_results_
215217
var channel1 = await CreateUniqueTempChannelAsync();
216218
var channel2 = await CreateUniqueTempChannelAsync();
217219
var channel3 = await CreateUniqueTempChannelAsync();
218-
var allChannels = new [] { channel1, channel2, channel3 };
220+
var allChannels = new[] { channel1, channel2, channel3 };
219221

220222
var filters = new IFieldFilterRule[]
221223
{
222224
ChannelFilter.CreatedAt.GreaterThanOrEquals(DateTime.UtcNow.AddMinutes(-5)),
223225
};
224226

225-
var channels = await TryAsync(() => Client.QueryChannelsAsync(filters, _sortByCreatedAtAscending),
227+
var channels = await TryAsync(() => Client.QueryChannelsAsync(filters, _sortByCreatedAtAscending),
226228
channels => allChannels.All(channels.Contains));
227229
Assert.IsTrue(allChannels.All(channels.Contains));
228230
}

Assets/Plugins/StreamChat/Tests/StatefulClient/ClientStateSyncTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ private async Task When_client_reconnects_expect_receiving_missed_messages_Async
5656
await GetConnectedOtherClientAsync();
5757

5858
// Wait for sync request to complete
59-
await WaitWhileTrueAsync(() => otherClientChannel.Messages.All(m => m.Id != message.Id));
59+
await WaitWhileTrueAsync(()
60+
=> otherClientChannel.Messages.All(m => m.Id != message.Id || m.Id != message2.Id));
6061

6162
// Messages should now be present on the second client with no duplicates
6263
Assert.IsNotNull(otherClientChannel.Messages.Single(m => m.Id == message.Id));

0 commit comments

Comments
 (0)