Return full chat list
This commit is contained in:
@@ -110,6 +110,48 @@ public sealed class ApiSmokeTests : IDisposable
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ChatListReturnsAllChatsBeyondLegacyLimit()
|
||||
{
|
||||
using var factory = _factory.WithWebHostBuilder(builder =>
|
||||
{
|
||||
builder.ConfigureTestServices(services =>
|
||||
{
|
||||
services.RemoveAll<IHostedService>();
|
||||
});
|
||||
});
|
||||
using var client = factory.CreateClient();
|
||||
await LoginAsync(client);
|
||||
|
||||
using (var scope = factory.Services.CreateScope())
|
||||
{
|
||||
var db = scope.ServiceProvider.GetRequiredService<QMaxDbContext>();
|
||||
for (var index = 0; index < 221; index++)
|
||||
{
|
||||
db.Chats.Add(new Chat
|
||||
{
|
||||
ExternalId = $"bulk-chat-{index:D3}",
|
||||
Title = index switch
|
||||
{
|
||||
219 => "\u0421\u0430\u0438\u0434",
|
||||
220 => "\u0410\u043d\u044e\u0442\u0430",
|
||||
_ => $"Bulk Chat {index:D3}"
|
||||
},
|
||||
Kind = ChatKind.MaxDialog,
|
||||
LastMessageAt = DateTimeOffset.UtcNow.AddMinutes(-index)
|
||||
});
|
||||
}
|
||||
|
||||
await db.SaveChangesAsync();
|
||||
}
|
||||
|
||||
var chats = await client.GetFromJsonAsync<ChatDto[]>("/api/chats", JsonOptions);
|
||||
Assert.NotNull(chats);
|
||||
Assert.Equal(221, chats!.Count(x => x.ExternalId?.StartsWith("bulk-chat-", StringComparison.Ordinal) == true));
|
||||
Assert.Contains(chats, x => x.Title == "\u0421\u0430\u0438\u0434");
|
||||
Assert.Contains(chats, x => x.Title == "\u0410\u043d\u044e\u0442\u0430");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task SyncMergesLateDiscoveredAttachmentsIntoExistingMessage()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user