Skip to content

Expand test coverage and extract cloud support decision logic#176

Merged
jasonjoh merged 2 commits into
mainfrom
copilot
Jul 10, 2026
Merged

Expand test coverage and extract cloud support decision logic#176
jasonjoh merged 2 commits into
mainfrom
copilot

Conversation

@jasonjoh

Copy link
Copy Markdown
Member

Summary

Expands the test suite from 12 to 90 tests and extracts the previously-untested cloud-support decision logic out of Program.cs into a testable unit.

Changes

Extracted decision logic

  • New CloudSupportStatusEvaluator (src/Docs/) with:
    • Merge(accumulated, operationStatus, out mismatch) — combines an operation's status into the running total, OR-combining when known statuses disagree (surfacing a mismatch flag so callers still log the warning).
    • RequiresVersionPivot(v1Status, betaStatus) — decides whether a doc needs separate v1/beta include lines.
  • Refactored all four call sites in Program.cs (root-command loop + v1/beta loops in the copilot command + the version-pivot if). Behavior and log output are preserved exactly.

New test coverage

  • Cloud-matching engineGetNodeByPath ({id} matching, () function suffix, unknown-path null) and GetCloudSupportStatus (Global / AllClouds / GlobalAndChina, method-not-present, null method, US Gov L5 exclusion stripping), backed by minimal OpenAPI YAML fixtures.
  • OpenAPIOverrides — override remapping (operation constraints, case-insensitivity), per-path+method+cloud exclusion (incl. backslash normalization), and per-file exclusion.
  • INCLUDE mapping/writers — all 8 CloudSupportStatus → include-file mappings, unmapped-status throw, update-in-place, and the zone-pivoted writer.
  • ApiOperation — parsing plus error paths (empty, missing path, invalid HTTP method).
  • StringExtensions — the 9 previously-untested methods, incl. IsEqualIgnoringCase's OData-parameter branch.
  • DocSet — recursive loading and doc_type skipping (conceptual + missing doc_type).
  • CloudSupportStatusEvaluator — full unit coverage of both methods.

Testing

dotnet test90 passed, 0 failed.

Tests touching the static OpenAPIOverrides state are serialized via a shared xUnit collection to avoid cross-class races; INCLUDE-writing tests operate on temp copies so committed fixtures are never modified.

jasonjoh and others added 2 commits July 10, 2026 13:00
Add unit tests for the cloud-matching engine (GetNodeByPath,
GetCloudSupportStatus), OpenAPIOverrides, CloudSupportStatus to INCLUDE
file mapping and include writers, ApiOperation parsing/error paths, the
remaining StringExtensions methods, and DocSet directory loading /
doc_type skipping.

Extract the duplicated status-merge and version-pivot decision logic
from Program.cs into a testable CloudSupportStatusEvaluator, and cover
it with unit tests. Test suite grows from 12 to 90 tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 3fba873e-7a3c-46e6-8884-edf08f26692a
@jasonjoh jasonjoh merged commit 093f06c into main Jul 10, 2026
2 checks passed
@jasonjoh jasonjoh deleted the copilot branch July 10, 2026 18:02
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