feat/estimate #50

Merged
notazof merged 27 commits from feat/estimate into main 2026-09-04 22:07:17 +01:00
Showing only changes of commit 81beb0a102 - Show all commits

test the avatar failback
All checks were successful
Dotnet build and test / build (pull_request) Successful in 13m35s

Paul Schneider 2026-09-04 15:21:42 +01:00
Signed by: notazof
GPG key ID: 1DD5D838E5343B06

View file

@ -0,0 +1,34 @@
namespace Yavsc.Org.Tests.NonRegression;
/// <summary>
/// Non-regression: avatar requests under /avatars must never return 404
/// for missing files. The pipeline falls back to static defaults under
/// /images/Users/icon_user*.png.
/// </summary>
public class AvatarFallbackTests : IClassFixture<TestWebApplicationFactory>
{
private readonly TestWebApplicationFactory _factory;
public AvatarFallbackTests(TestWebApplicationFactory factory)
{
_factory = factory;
}
[Theory]
[InlineData("/avatars/user-does-not-exist.png")]
[InlineData("/avatars/user-does-not-exist.s.png")]
[InlineData("/avatars/user-does-not-exist.xs.png")]
public async Task Missing_avatar_file_returns_default_image_instead_of_404(string path)
{
using var client = _factory.CreateClient();
var ct = TestContext.Current.CancellationToken;
var response = await client.GetAsync(path, ct);
Assert.Equal(System.Net.HttpStatusCode.OK, response.StatusCode);
Assert.Equal("image/png", response.Content.Headers.ContentType?.MediaType);
var payload = await response.Content.ReadAsByteArrayAsync(ct);
Assert.True(payload.Length > 0, $"Expected a non-empty fallback image for {path}.");
}
}