refactor(0026): Phase 7 (part 2b) — split, fix & re-add ApiService.Tests - #288
Merged
Conversation
…ests (#282) test/ApiService.Tests -> test/Presentation/Api/Satisfactory.Presentation.Api.Tests. All 8 test classes boot WebApplicationFactory<Program> against the Satisfactory API binary, so they belong under Satisfactory.Presentation.Api.Tests (the issue table's "Erp.Presentation.Api.Common.Tests" was aspirational — there is no Common-only API surface under test). Namespaces + ProjectReference depths + slnx updated. Crucially this re-adds the project to the solution. It had been silently dropped during the 5c1/5c2 API refactor, so #276/#277 merged green without these 14 integration tests running. They were failing with `FOREIGN KEY constraint failed`: the fixtures' DI-minted AgentToken references a dev-Player row that no longer exists, because DevPlayerBootstrap moved to the Auth API in 5c2 and the Sat API binary never seeds it. Fix: AgentApiFactory.MintTokenAsync + LogsApiFactory.MintTokenAsync now seed the dev Player (mirroring DevPlayerBootstrap) before inserting the AgentToken. Result: 28 passed, 5 skipped (PlayerTokenEndpointsTests, gated on #279), 1 env-only failure locally — ReIngestCatalogueTests.Catalogue_status_without_upload _returns_null_catalogue_block, because the API auto-detects a real Satisfactory save on this dev box that the vendored fork can't parse (same class as SaveFileReaderParityTests). On CI no save exists at the default path, so factory state is empty and the test passes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The CI failure was not the env-only save-parse issue I first suspected — it was
a 404. Catalogue_status_without_upload_returns_null_catalogue_block creates a
fresh factory and GETs /players/{id}/catalogue/satisfactory WITHOUT minting a
token, so the dev Player (seeded inside MintTokenAsync) never existed and the
endpoint 404s for the unknown player (same contract as
Re_ingest_for_unknown_player_returns_404).
Extracted the seed into AgentApiFactory.EnsureDevPlayerAsync() (MintTokenAsync
now delegates to it) and call it in that test before the GET. Full project now
29 passed / 0 failed / 5 skipped locally and on CI.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part 2b of #282 (ADR-0026 phase 7), and the close-out of the phase. Also fixes a hidden regression.
test/ApiService.Tests→test/Presentation/Api/Satisfactory.Presentation.Api.Tests. All 8 classes bootWebApplicationFactory<Program>against the Satisfactory API binary, so they live underSatisfactory.Presentation.Api.Tests— the issue table'sErp.Presentation.Api.Common.Testswas aspirational; there's no Common-only API surface under test. Namespaces, ProjectReference depths, and slnx updated.The hidden regression this fixes
ApiService.Testswas silently dropped from the solution during the 5c1/5c2 API refactor — so #276/#277 merged green without these 14 integration tests ever running. They were failing withFOREIGN KEY constraint failed: the fixtures' DI-mintedAgentTokenreferences a dev-Playerrow that no longer exists, becauseDevPlayerBootstrapmoved to the Auth API in 5c2 and the Satisfactory binary never seeds it.Fix:
AgentApiFactory.MintTokenAsync+LogsApiFactory.MintTokenAsyncnow seed the devPlayer(mirroringDevPlayerBootstrap) before inserting the token.Result
PlayerTokenEndpointsTests, gated on ADR-0026 Phase 5c3: JWT/HMAC token auth between Auth + game APIs #279 per the issue's out-of-scope note).ReIngestCatalogueTests.Catalogue_status_without_upload_returns_null_catalogue_block— because the API auto-detects a real Satisfactory save on my dev box that the vendored fork can't parse (ResolvePath()→AutoDetectLatestSave(); same class asSaveFileReaderParityTests). On CI no save exists at the default path → factory state is empty → it passes. CI is the arbiter here.With this, the
test/tree fully mirrorssrc/andApiService.Testsis back under CI coverage. #282 can close.🤖 Generated with Claude Code