Skip to content

test(tests): API response contract tests — Phase 2 - #65

Merged
amodelandme merged 3 commits into
devfrom
feat/contract-tests
May 17, 2026
Merged

amodelandme merged 3 commits into
devfrom
feat/contract-tests

Conversation

@amodelandme

Copy link
Copy Markdown
Owner

Summary

Five new integration tests in ContractTests.cs pin the JSON wire shape of every API success response using raw JsonDocument assertions — not typed deserialization. Two shared helper
methods in IntegrationTestBase (ReadProblemDetailsAsync and ReadValidationProblemDetailsAsync) were extended to assert camelCase field-name presence on all error responses. A new
ReadRawJsonAsync helper was added to IntegrationTestBase as shared infrastructure for the contract tests and future tests that need raw JSON access.

Changes in this PR

  • Tests — ContractTests.cs (new): 5 integration tests covering FlagResponse, FlagResponse[], EvaluationResponse, and FlagHealthAnalysisResponse + FlagAssessment wire
    shapes
  • Tests — IntegrationTestBase.cs (modified): ReadRawJsonAsync helper; camelCase field-name assertions added to ReadProblemDetailsAsync and ReadValidationProblemDetailsAsync
  • Docs — spec, implementation notes, current-state.md, roadmap.md

Spec

Docs/Decisions/contract-tests/spec.md

Implementation Notes

Docs/Decisions/contract-tests/implementation-notes.md

Definition of Done

  • ContractTests.cs created, inheriting IntegrationTestBase
  • ReadRawJsonAsync helper added to IntegrationTestBase
  • ProblemDetails field-name assertions (AC-6, AC-7)
  • AC-1 through AC-5: all success response shapes pinned
  • Build clean, 278/278 tests green, CSharpier passes

Testing

dotnet test Banderas.Tests.Integration --filter "FullyQualifiedName~ContractTests"

Developer and others added 3 commits May 16, 2026 20:00
- Correct postStartCommand network name from bandera_default to featureflagservice_default
- Add http launch profile that omits the connection string env var, letting appsettings.Development.json resolve Host=postgres via Docker DNS
- Rename old http profile to local for running outside the container

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ests

Add ContractTests.cs with 5 integration tests that parse raw JsonDocument
to assert exact camelCase field names, enum-as-string serialization, and
Content-Type on all success response shapes (FlagResponse, FlagResponse[],
EvaluationResponse, FlagHealthAnalysisResponse + FlagAssessment).

Extend IntegrationTestBase with ReadRawJsonAsync helper and add camelCase
field-name assertions to ReadProblemDetailsAsync and
ReadValidationProblemDetailsAsync so every error-path test in the suite
covers the ProblemDetails wire contract for free.

278/278 tests passing (203 unit + 75 integration).
…tion doc updates

Spec: Docs/Decisions/contract-tests/spec.md
Implementation notes: Docs/Decisions/contract-tests/implementation-notes.md
current-state.md: status updated, test counts updated (278 green),
  completed work added, next tasks refreshed, lesson learned added.
roadmap.md: Phase 2 contract tests item checked, current focus updated.
@amodelandme
amodelandme merged commit 0b7fe63 into dev May 17, 2026
5 checks passed
@amodelandme
amodelandme deleted the feat/contract-tests branch May 17, 2026 03:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant