File tree Expand file tree Collapse file tree 3 files changed +1598
-1
lines changed
tests/FSharp.Data.GraphQL.Tests Expand file tree Collapse file tree 3 files changed +1598
-1
lines changed Original file line number Diff line number Diff line change 6969 <Compile Include =" AspNetCore/TestSchema.fs" />
7070 <Compile Include =" AspNetCore/InvalidMessageTests.fs" />
7171 <Compile Include =" AspNetCore/SerializationTests.fs" />
72+ <Compile Include =" ResponseJsonTests.fs" />
7273 <Compile Include =" Program.fs" />
7374 </ItemGroup >
7475
8182 <ProjectReference Include =" ..\..\src\FSharp.Data.GraphQL.Shared\FSharp.Data.GraphQL.Shared.fsproj" />
8283 <ProjectReference Include =" ..\..\src\FSharp.Data.GraphQL.Server\FSharp.Data.GraphQL.Server.fsproj" />
8384 <ProjectReference Include =" ..\..\src\FSharp.Data.GraphQL.Server.AspNetCore\FSharp.Data.GraphQL.Server.AspNetCore.fsproj" />
85+ <ProjectReference Include =" ..\..\src\FSharp.Data.GraphQL.Client.DesignTime\FSharp.Data.GraphQL.Client.DesignTime.fsproj" />
8486 <ProjectReference Include =" ..\..\src\FSharp.Data.GraphQL.Server.Middleware\FSharp.Data.GraphQL.Server.Middleware.fsproj" />
8587 </ItemGroup >
86- </Project >
88+ </Project >
89+ <ItemGroup Condition =" $(OS) == Unix" >
90+ <Content Include =" xunit.runner.json" CopyToOutputDirectory =" PreserveNewest" />
91+ </ItemGroup >
92+ <Import Project =" ..\..\netfx.props" />
93+ <Import Project =" ..\..\.paket\Paket.Restore.targets" />
94+ </Project >
Original file line number Diff line number Diff line change 1+ module FSharp.Data.GraphQL.Tests.ResponseJsonTests
2+
3+ open System
4+ open Xunit
5+ open Helpers
6+ open FSharp.Data .GraphQL
7+ open FSharp.Data .GraphQL .Client
8+
9+ // Local provider should be able to be created from local introspection json file.
10+ // This schema is adjusted to have some less common type names in order to test them.
11+ type Provider = GraphQLProvider< " introspection-altered-types.json" >
12+
13+
14+ [<Fact>]
15+ let ``Should be able to parse nullable ID`` () =
16+ let op = Provider.Operation< """ query TestQuery {
17+ hero(id:"1000") {
18+ id,
19+ name,
20+ appearsIn,
21+ homePlanet,
22+ friends {
23+ ... on Human {
24+ name,
25+ id
26+ }
27+ ... on Droid {
28+ name,
29+ id
30+ }
31+ }
32+ }
33+ }""" >
34+ let xop = op()
35+ let result1 = xop.ParseResult( """ {
36+ "documentId": 2018203290,
37+ "data": {
38+ "hero": {
39+ "id": "1000",
40+ "__typename": "Human",
41+ "name": "Luke Skywalker",
42+ "appearsIn": [
43+ "NewHope",
44+ "Empire",
45+ "Jedi"
46+ ],
47+ "homePlanet": "Tatooine",
48+ "friends": [
49+ {
50+ "name": "Han Solo",
51+ "id": "1002",
52+ "__typename": "Human"
53+ },
54+ {
55+ "name": "Leia Organa",
56+ "id": "1003",
57+ "__typename": "Human"
58+ },
59+ {
60+ "name": "C-3PO",
61+ "id": "2000",
62+ "__typename": "Droid"
63+ },
64+ {
65+ "name": "R2-D2",
66+ "id": "2001",
67+ "__typename": "Droid"
68+ }
69+ ]
70+ }
71+ }
72+ }""" )
73+ ()
You can’t perform that action at this time.
0 commit comments