Commit graph yavsc/src/Yavsc.Blogs.Tests/BlogApiMappedClaimsTests.cs
Author SHA1 Message Date
8c8ab70d38
REORG 2026-09-26 00:35:43 +01:00
a12830e49b
test(blogs): configure SiteSettings.Blog in MappedClaimsBlogsWebServerFixture
Some checks failed
Forgejo Release / release (push) Failing after 6m42s
Dotnet build and test / build (pull_request) Failing after 5m30s
BlogSpotService's constructor throws InvalidOperationException
("SiteSettings.Blog is not configured.") when IOptions<SiteSettings>.Blog
is null, so every request to BlogApiController 500'd resolving the
service — all 3 BlogApiMappedClaimsTests were failing with
InternalServerError.

The mapped-claims fixture never configured SiteSettings (the main
BlogsWebServerFixture does, pointing Blog at a per-run temp dir).
Mirror that: Configure<SiteSettings>(s => s.Blog = <temp dir>)
before AddScoped<BlogSpotService>(). These tests are JSON-only
(AttachFiles short-circuits), but the service must be constructible.

Verified: BlogApiMappedClaimsTests 3/3 green; full Yavsc.Blogs.Tests
37/37 green.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-09-19 14:14:28 +01:00
79398ca3e9 Disposing the test fixtures 2026-08-29 04:00:10 +01:00
21a41214b0 fixes the tests 2026-08-28 22:41:05 +01:00
7edb2d7915 refacto + test fixes 2026-08-28 21:33:11 +01:00
105284e5e4 tests(blogs): pass TestContext.Current.CancellationToken to HTTP calls
xUnit1051: HTTP helpers (GetAsync, PostAsJsonAsync, PutAsJsonAsync,
DeleteAsync) accept a CancellationToken that the test runner can use
to cancel a long-running suite. Forwarding TestContext.Current.
CancellationToken to every call lets the runner respond to Ctrl+C /
--blame-hang-timeout at the granularity of a single test instead of
the whole process.

Covers PublishEndpointTests (10 calls), CircleMembersApiTests
(11 calls) and BlogApiMappedClaimsTests (9 calls). BlogApiTests.cs
was already clean after 422e8b76.
2026-08-22 03:45:59 +01:00
4e1ceb729c GetUserId_reads_NameIdentifier_when_sub_was_mapped 2026-08-10 18:34:01 +01:00