Skip to content

Commit 3c07676

Browse files
committed
add defer test case
1 parent b8aafad commit 3c07676

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

src/test/groovy/graphql/execution/incremental/DeferExecutionSupportIntegrationTest.groovy

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1633,6 +1633,47 @@ class DeferExecutionSupportIntegrationTest extends Specification {
16331633
!(result instanceof IncrementalExecutionResult)
16341634

16351635

1636+
}
1637+
1638+
def "two fragments one same type"() {
1639+
given:
1640+
def query = '''
1641+
query {
1642+
post {
1643+
id
1644+
...f1
1645+
...f2 @defer
1646+
}
1647+
}
1648+
1649+
fragment f1 on Post {
1650+
text
1651+
}
1652+
fragment f2 on Post {
1653+
summary
1654+
}
1655+
'''
1656+
when:
1657+
def initialResult = executeQuery(query)
1658+
1659+
then:
1660+
initialResult.toSpecification() == [
1661+
data : [post: [id: "1001", text: "The full text"]],
1662+
hasNext: true
1663+
]
1664+
1665+
when:
1666+
def incrementalResults = getIncrementalResults(initialResult)
1667+
1668+
then:
1669+
// Ordering is non-deterministic, so we assert on the things we know are going to be true.
1670+
1671+
incrementalResults.size() == 1
1672+
incrementalResults[0] == [hasNext : false,
1673+
incremental: [[path: ["post"], data: [summary: "A summary"]]]
1674+
]
1675+
1676+
16361677
}
16371678

16381679

0 commit comments

Comments
 (0)