Skip to content

Commit e15c1ce

Browse files
Copilotxperiandri
andauthored
Restore tools and run Fantomas twice on OperationErrorTests
Agent-Logs-Url: https://github.com/fsprojects/FSharp.Data.GraphQL/sessions/d4e498c5-b77d-403f-bcfd-2ce7208c1e75 Co-authored-by: xperiandri <2365592+xperiandri@users.noreply.github.com>
1 parent 513aba4 commit e15c1ce

1 file changed

Lines changed: 27 additions & 22 deletions

File tree

tests/FSharp.Data.GraphQL.IntegrationTests/OperationErrorTests.fs

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,24 @@ open Helpers
66
open FSharp.Data.GraphQL
77
open FSharp.Data.GraphQL.Client
88

9-
let [<Literal>] ServerUrl = "http://localhost:8085"
9+
[<Literal>]
10+
let ServerUrl = "http://localhost:8085"
1011

11-
type Provider = GraphQLProvider<ServerUrl, uploadInputTypeName = "File", explicitOptionalParameters = false>
12+
type Provider = GraphQLProvider<ServerUrl, uploadInputTypeName="File", explicitOptionalParameters=false>
1213

1314
module ErrorOperation =
1415
let operation =
1516
Provider.Operation<"""query ErrorQuery {
1617
alwaysError
17-
}""">()
18+
}"""> ()
1819

1920
type Operation = Provider.Operations.ErrorQuery
2021

2122
[<Fact; Trait("OperationError", "Unit")>]
2223
let ``Should parse operation error fields from raw response`` () =
2324
let result =
24-
OperationResultBase(
25-
rawResponse = new HttpResponseMessage(),
25+
OperationResultBase (
26+
rawResponse = new HttpResponseMessage (),
2627
responseJson =
2728
JsonValue.Parse
2829
"""{
@@ -49,30 +50,33 @@ let ``Should parse operation error fields from raw response`` () =
4950

5051
[<Fact; Trait("OperationError", "Unit")>]
5152
let ``Should parse all combinations of optional operation error fields`` () =
52-
let combinations =
53-
[ for includePath in [ false; true ] do
54-
for includeLocations in [ false; true ] do
55-
for includeExtensions in [ false; true ] do
56-
includePath, includeLocations, includeExtensions ]
53+
let combinations = [
54+
for includePath in [ false; true ] do
55+
for includeLocations in [ false; true ] do
56+
for includeExtensions in [ false; true ] do
57+
includePath, includeLocations, includeExtensions
58+
]
5759

5860
for includePath, includeLocations, includeExtensions in combinations do
59-
let optionalFields =
60-
[ if includePath then
61-
"\"path\":[\"alwaysError\",0]"
62-
if includeLocations then
63-
"\"locations\":[{\"line\":2,\"column\":13}]"
64-
if includeExtensions then
65-
"\"extensions\":{\"code\":\"UNIT_TEST\",\"retryable\":false,\"severity\":7}" ]
61+
let optionalFields = [
62+
if includePath then
63+
"\"path\":[\"alwaysError\",0]"
64+
if includeLocations then
65+
"\"locations\":[{\"line\":2,\"column\":13}]"
66+
if includeExtensions then
67+
"\"extensions\":{\"code\":\"UNIT_TEST\",\"retryable\":false,\"severity\":7}"
68+
]
6669

6770
let errorObjectJson =
68-
"\"message\":\"unit-test combination error\"" :: optionalFields
71+
"\"message\":\"unit-test combination error\""
72+
:: optionalFields
6973
|> String.concat ","
7074

7175
let responseJson = $"""{{"errors":[{{{errorObjectJson}}}]}}"""
7276

7377
let result =
74-
OperationResultBase(
75-
rawResponse = new HttpResponseMessage(),
78+
OperationResultBase (
79+
rawResponse = new HttpResponseMessage (),
7680
responseJson = JsonValue.Parse responseJson,
7781
operationFields = [||],
7882
operationTypeName = "Query"
@@ -102,7 +106,7 @@ let ``Should parse all combinations of optional operation error fields`` () =
102106

103107
[<Fact; Trait("OperationError", "Integration")>]
104108
let ``Should map server error extensions and locations into operation result`` () =
105-
let result = ErrorOperation.operation.Run()
109+
let result = ErrorOperation.operation.Run ()
106110

107111
result.Errors.Length |> equals 1
108112

@@ -113,7 +117,8 @@ let ``Should map server error extensions and locations into operation result`` (
113117
error.Locations |> equals [||]
114118

115119
error.Extensions.ContainsKey "code" |> equals true
116-
error.Extensions.["code"] |> equals (box "OPERATION_ERROR_TEST")
120+
error.Extensions.["code"]
121+
|> equals (box "OPERATION_ERROR_TEST")
117122
error.Extensions.ContainsKey "severity" |> equals true
118123
error.Extensions.["severity"] |> equals (box 7)
119124
error.Extensions.ContainsKey "kind" |> equals true

0 commit comments

Comments
 (0)