Skip to content

Commit

Permalink
Added test for issue 6050
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelstaib committed Apr 25, 2023
1 parent 0f6723f commit 609ff74
Showing 1 changed file with 48 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,52 @@ nodes @include(if: true) @skip(if: false) {
""");
}

// https://github.com/ChilliCream/graphql-platform/issues/6050
[Fact]
public async Task Issue_6050()
{
var result =
await new ServiceCollection()
.AddGraphQLServer()
.AddQueryType<Query>()
.ExecuteRequestAsync(
QueryRequestBuilder.New()
.SetQuery(
"""
query($permission: Boolean!) {
person {
...A
...B @include(if: $permission)
__typename
}
}
fragment A on Person {
name
__typename
}
fragment B on Person {
address
__typename
}
""")
.SetVariableValue("permission", false)
.Create());

result.MatchInlineSnapshot(
"""
{
"data": {
"person": {
"name": "hello",
"__typename": "Person"
}
}
}
""");
}

public sealed class Query
{
public Person Person() => new Person();
Expand All @@ -609,5 +655,7 @@ public sealed class Query
public sealed class Person
{
public string Name { get; } = "hello";

public string Address { get; } = "world";
}
}

0 comments on commit 609ff74

Please sign in to comment.