forked from fsprojects/FSharp.Data.GraphQL
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReservedScalarNameProviderTests.fs
More file actions
47 lines (37 loc) · 1.52 KB
/
ReservedScalarNameProviderTests.fs
File metadata and controls
47 lines (37 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
module FSharp.Data.GraphQL.IntegrationTests.ReservedScalarNameProviderTests
open Xunit
open FSharp.Data.GraphQL
type ObjectDateProvider = GraphQLProvider<"reserved_scalar_object_date_introspection.json">
type InputDateProvider = GraphQLProvider<"reserved_scalar_input_date_introspection.json">
module ObjectDateSchema =
type SchemaDate = ObjectDateProvider.Types.Date
let operation =
ObjectDateProvider.Operation<"""query Q {
dateInfo {
value
category
}
}""">()
let compileSmoke () =
let schemaDate = SchemaDate(value = "2026-04-03", category = "default")
let operationInstance : ObjectDateProvider.Operations.Q = operation
schemaDate |> ignore
operationInstance |> ignore
module InputDateSchema =
type SchemaDate = InputDateProvider.Types.Date
let operation =
InputDateProvider.Operation<"""query Q($input: Date) {
echoDate(input: $input)
}""">()
let compileSmoke () =
let schemaDate = SchemaDate(value = "2026-04-03", category = "default")
let deferredRun : unit -> _ =
fun () -> operation.Run(Unchecked.defaultof<GraphQLProviderRuntimeContext>, schemaDate)
schemaDate |> ignore
deferredRun |> ignore
[<Fact>]
let ``Should allow object types that reuse reserved scalar names`` () =
ObjectDateSchema.compileSmoke ()
[<Fact>]
let ``Should allow input object types that reuse reserved scalar names`` () =
InputDateSchema.compileSmoke ()