Skip to content

[repo-assist] test: add missing coverage for Option(byte[]), plain Guid, and leading-slash+fragment URLs#464

Merged
sergey-tihon merged 2 commits into
masterfrom
repo-assist/test-query-param-gaps-20260627-4473fc208cb78667
Jun 27, 2026
Merged

[repo-assist] test: add missing coverage for Option(byte[]), plain Guid, and leading-slash+fragment URLs#464
sergey-tihon merged 2 commits into
masterfrom
repo-assist/test-query-param-gaps-20260627-4473fc208cb78667

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

🤖 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 the Option<byte[]> arm (source lines 265–268) and the plain-Guid fall-through path, neither of which had any test:

Test Code path exercised
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 obj with | :? Guid as g -> g.ToString()

CreateHttpRequestTests — two tests for the leading-slash-stripping + fragment-identifier combination:

Test Scenario
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) and v1/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

Generated by 🌈 Repo Assist, see workflow run. Learn more.

Add this agentic workflows to your repo

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@e15e57b40918dbca11b350c55d02ab61934afa75

…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>
@sergey-tihon sergey-tihon marked this pull request as ready for review June 27, 2026 05:52
Copilot AI review requested due to automatic review settings June 27, 2026 05:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 toQueryParams handling of Option<byte[]> (Some) and scalar Guid.
  • Add tests for createHttpRequest when 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.

Comment thread tests/SwaggerProvider.Tests/RuntimeHelpersTests.fs
@sergey-tihon sergey-tihon merged commit fab4d37 into master Jun 27, 2026
3 checks passed
@sergey-tihon sergey-tihon deleted the repo-assist/test-query-param-gaps-20260627-4473fc208cb78667 branch June 29, 2026 06:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants