Add ApiFactory test helper + /health sanity test

This commit is contained in:
2026-06-11 18:17:48 +00:00
parent 2c16a9485b
commit f2bb2d984b
3 changed files with 52 additions and 10 deletions
+19
View File
@@ -0,0 +1,19 @@
using System.Net;
using FluentAssertions;
using Xunit;
namespace backend.tests;
public class HealthTests(ApiFactory factory) : IClassFixture<ApiFactory>
{
private readonly ApiFactory _factory = factory;
[Fact]
public async Task Health_returns_ok()
{
var client = _factory.CreateClient();
var res = await client.GetAsync("/health");
res.StatusCode.Should().Be(HttpStatusCode.OK);
(await res.Content.ReadAsStringAsync()).Should().Contain("\"ok\":true");
}
}