From 895c9e1d38e1cad88ab71655ff9a38dc7f6781d0 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 27 Jun 2026 03:35:21 +0000 Subject: [PATCH 1/2] test: add missing coverage for Option, plain Guid, and leading-slash+fragment URLs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add 5 tests covering previously untested code paths in RuntimeHelpers: - toQueryParams handles Option Some as base64 (the dedicated Option arm in RuntimeHelpers.fs was not exercised) - toQueryParams handles Option 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> --- .../RuntimeHelpersTests.fs | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/tests/SwaggerProvider.Tests/RuntimeHelpersTests.fs b/tests/SwaggerProvider.Tests/RuntimeHelpersTests.fs index b45c9f7a..14ed60c0 100644 --- a/tests/SwaggerProvider.Tests/RuntimeHelpersTests.fs +++ b/tests/SwaggerProvider.Tests/RuntimeHelpersTests.fs @@ -371,6 +371,26 @@ module ToQueryParamsTests = let result = toQueryParams "data" (box bytes) stubClient result |> shouldEqual [ ("data", expected) ] + [] + let ``toQueryParams handles Option Some as base64``() = + // Option Some is handled by the dedicated arm (lines 265-268 of RuntimeHelpers.fs) + let bytes = [| 72uy; 101uy; 108uy; 108uy; 111uy |] // "Hello" in ASCII + let expected = (JsonSerializer.Serialize bytes).Trim('"') + let result = toQueryParams "data" (box(Some bytes)) stubClient + result |> shouldEqual [ ("data", expected) ] + + [] + let ``toQueryParams handles Option None as empty list``() = + let result = toQueryParams "data" (box(None: byte[] option)) stubClient + result |> shouldEqual [] + + [] + let ``toQueryParams handles plain Guid``() = + // Plain Guid (non-option, non-array) falls through to toParam which uses Guid.ToString() + let g = Guid("d3b07384-d9a2-4e3f-9a4b-1234567890ab") + let result = toQueryParams "id" (box g) stubClient + result |> shouldEqual [ ("id", g.ToString()) ] + [] let ``toQueryParams skips None items in Option array``() = let values: Option[] = [| Some "a"; None; Some "c" |] @@ -728,6 +748,18 @@ module CreateHttpRequestTests = req.RequestUri.OriginalString |> shouldEqual "v1/items?existing=1&page=2#section" + [] + let ``createHttpRequest strips leading slash from path with fragment and no query params``() = + // The fragment must be preserved when TrimStart('/') strips the leading slash and no + // params are added (sb remains null, so the original trimmed address is returned). + use req = createHttpRequest "GET" "/path#section" [] + req.RequestUri.OriginalString |> shouldEqual "path#section" + + [] + let ``createHttpRequest strips leading slash and appends params before fragment``() = + use req = createHttpRequest "GET" "/path#section" [ ("q", "v") ] + req.RequestUri.OriginalString |> shouldEqual "path?q=v#section" + module FillHeadersTests = From e5c6462331281e4ebbaaadb0cd6e339e6f4b396d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 27 Jun 2026 03:35:24 +0000 Subject: [PATCH 2/2] ci: trigger checks