[repo-assist] test: add missing coverage for Option(byte[]), plain Guid, and leading-slash+fragment URLs#464
Merged
sergey-tihon merged 2 commits intoJun 27, 2026
Conversation
…g-slash+fragment URLs Add 5 tests covering previously untested code paths in RuntimeHelpers: - toQueryParams handles Option<byte array> Some as base64 (the dedicated Option<byte[]> arm in RuntimeHelpers.fs was not exercised) - toQueryParams handles Option<byte array> None returns empty list - toQueryParams handles plain Guid (non-option, non-array falls through to toParam) - createHttpRequest strips leading slash from path with fragment (no query params) - createHttpRequest strips leading slash and appends params before fragment Test count: 517 → 522 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds targeted unit tests in RuntimeHelpersTests.fs to cover previously untested branches in RuntimeHelpers.fs, focusing on query-parameter serialization and URL construction edge cases (byte-array options, scalar Guid, and leading-slash + fragment URLs).
Changes:
- Add tests for
toQueryParamshandling ofOption<byte[]>(Some) and scalarGuid. - Add tests for
createHttpRequestwhen combining leading-slash trimming with URL fragments, with and without query params.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
🤖 This PR was created by Repo Assist, an automated AI assistant.
Summary
This PR adds 5 unit tests covering previously untested code paths in
RuntimeHelpers.fs. These gaps were identified during a systematic review of test coverage against the source implementation.New tests (517 → 522)
ToQueryParamsTests— three tests covering theOption<byte[]>arm (source lines 265–268) and the plain-Guid fall-through path, neither of which had any test:toQueryParams handles Option<byte array> Some as base64| :? Option<array<byte>> as x -> Some xs → [name, serialize xs]toQueryParams handles Option<byte array> None as empty list| :? Option<array<byte>> as x -> None → []toQueryParams handles plain Guid| _ -> toParam objwith| :? Guid as g -> g.ToString()CreateHttpRequestTests— two tests for the leading-slash-stripping + fragment-identifier combination:createHttpRequest strips leading slash from path with fragment (no query params)"/path#section" []→"path#section"createHttpRequest strips leading slash and appends params before fragment"/path#section" [("q","v")]→"path?q=v#section"The existing tests already cover
/pets(leading slash, no fragment) andv1/items?existing=1#section(fragment with query params, no leading slash). These two tests close the missing combination.Test Status
✅ All 522 tests pass (
dotnet tests/SwaggerProvider.Tests/bin/Release/net10.0/SwaggerProvider.Tests.dll— 0 errors, 0 failures, 1 skipped)✅ Fantomas formatting check passes
Add this agentic workflows to your repo
To install this agentic workflow, run