-
Notifications
You must be signed in to change notification settings - Fork 60
Add missing toQueryParams test cases: float32/double/byte arrays and Option array types #304
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -170,6 +170,42 @@ module ToQueryParamsTests = | |||||||||||||||||
| let result = toQueryParams "id" (box [| g1; g2 |]) stubClient | ||||||||||||||||||
| result |> shouldEqual [ ("id", g1.ToString()); ("id", g2.ToString()) ] | ||||||||||||||||||
|
|
||||||||||||||||||
| [<Fact>] | ||||||||||||||||||
| let ``toQueryParams handles float32 array``() = | ||||||||||||||||||
| let result = toQueryParams "v" (box [| 1.5f; 2.5f |]) stubClient | ||||||||||||||||||
| result |> shouldEqual [ ("v", "1.5"); ("v", "2.5") ] | ||||||||||||||||||
|
|
||||||||||||||||||
| [<Fact>] | ||||||||||||||||||
| let ``toQueryParams handles double array``() = | ||||||||||||||||||
| let result = toQueryParams "v" (box [| 1.5; 2.5 |]) stubClient | ||||||||||||||||||
| result |> shouldEqual [ ("v", "1.5"); ("v", "2.5") ] | ||||||||||||||||||
|
Comment on lines
+179
to
+181
|
||||||||||||||||||
|
|
||||||||||||||||||
| [<Fact>] | ||||||||||||||||||
| let ``toQueryParams handles byte array as base64``() = | ||||||||||||||||||
| // byte[] is serialized via client.Serialize (JSON base64) with surrounding quotes trimmed | ||||||||||||||||||
| let bytes = [| 72uy; 101uy; 108uy; 108uy; 111uy |] // "Hello" in ASCII | ||||||||||||||||||
| let expected = (JsonSerializer.Serialize bytes).Trim('"') | ||||||||||||||||||
|
||||||||||||||||||
| let expected = (JsonSerializer.Serialize bytes).Trim('"') | |
| let expected = stubClient.Serialize(bytes).Trim('"') |
Copilot
AI
Mar 10, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hard-coded expected strings for Option<float32>[] have the same culture-sensitivity issue as the float array test. Since runtime behavior is ToString(), prefer deriving expected from 1.5f.ToString()/3.5f.ToString() (or explicit invariant formatting if intended).
| let values: Option<float32>[] = [| Some 1.5f; None; Some 3.5f |] | |
| let result = toQueryParams "v" (box values) stubClient | |
| result |> shouldEqual [ ("v", "1.5"); ("v", "3.5") ] | |
| let v1 = 1.5f | |
| let v3 = 3.5f | |
| let values: Option<float32>[] = [| Some v1; None; Some v3 |] | |
| let result = toQueryParams "v" (box values) stubClient | |
| result |> shouldEqual [ ("v", v1.ToString()); ("v", v3.ToString()) ] |
Copilot
AI
Mar 10, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hard-coded expected strings for Option<double>[] can be culture-dependent because toQueryParams uses ToString() for doubles. Prefer deriving expected from 1.5.ToString()/3.5.ToString() (or explicit invariant formatting if intended).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The expected values for float32 are hard-coded as "1.5"/"2.5", but
toQueryParamsultimately usesvalue.ToString()for floats, which is culture-sensitive. This test can fail on machines with a comma decimal separator. Prefer deriving expected strings from1.5f.ToString()etc. (or formatting withInvariantCultureif that’s the intended contract).