Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ public Builder incrementalItems(List<IncrementalPayload> incrementalItems) {
return this;
}

public Builder extensions(boolean hasNext) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

copy pasta bug I am guesing

this.hasNext = hasNext;
public Builder extensions(Map<Object, Object> extensions) {
this.extensions = extensions;
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import static graphql.incremental.StreamPayload.newStreamedItem

class IncrementalExecutionResultTest extends Specification {

def "sanity test to check builders work"() {
def "sanity test to check IncrementalExecutionResultImpl builder and item builders work"() {
when:
def defer1 = newDeferredItem()
.label("homeWorldDefer")
Expand Down Expand Up @@ -40,13 +40,15 @@ class IncrementalExecutionResultTest extends Specification {
])
.hasNext(true)
.incremental([defer1, stream1, stream2])
.extensions([some: "map"])

@sbarker2 sbarker2 Apr 11, 2024

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a similar extensions function test for another class that I've added as well

.build()

def toSpec = result.toSpecification()

then:
toSpec == [
data : [person: [name: "Luke Skywalker", films: [[title: "A New Hope"]]]],
extensions: [some: "map"],
hasNext : true,
incremental: [
[path: ["person"], label: "homeWorldDefer", data: [homeWorld: "Tatooine"]],
Expand All @@ -56,4 +58,28 @@ class IncrementalExecutionResultTest extends Specification {
]

}
def "sanity test to check DelayedIncrementalPartialResult builder works"() {
when:
def deferredItem = newDeferredItem()
.label("homeWorld")
.path(ResultPath.parse("/person"))
.data([homeWorld: "Tatooine"])
.build()

def result = DelayedIncrementalPartialResultImpl.newIncrementalExecutionResult()
.incrementalItems([deferredItem])
.hasNext(false)
.extensions([some: "map"])
.build()

def toSpec = result.toSpecification()

then:
toSpec == [
incremental: [[path: ["person"], label: "homeWorld", data: [homeWorld: "Tatooine"]]],
extensions: [some: "map"],
hasNext : false,
]

}
}