diff --git a/test/src/test/kotlin/graphql/nadel/tests/next/NadelIntegrationTest.kt b/test/src/test/kotlin/graphql/nadel/tests/next/NadelIntegrationTest.kt index 15ec825e2..2396cbd75 100644 --- a/test/src/test/kotlin/graphql/nadel/tests/next/NadelIntegrationTest.kt +++ b/test/src/test/kotlin/graphql/nadel/tests/next/NadelIntegrationTest.kt @@ -304,7 +304,7 @@ abstract class NadelIntegrationTest( // Note: we compare hasNext further down in the function compareJsonObject( expectedDelayedResult - "hasNext", - actualDelayedResult.toSpecification() - "hasNext", + actualDelayedResult - "hasNext", ).passed() } @@ -337,7 +337,10 @@ abstract class NadelIntegrationTest( .forEach { actualCall -> val delayedResults = actualCall.delayedResults if (delayedResults.isNotEmpty()) { - assertTrue(delayedResults.dropLast(n = 1).all { it.hasNext() } && !delayedResults.last().hasNext()) + assertTrue( + delayedResults.dropLast(n = 1).all { it["hasNext"] == true } + && delayedResults.last()["hasNext"] == false + ) } } } diff --git a/test/src/test/kotlin/graphql/nadel/tests/next/TestExecutionCapture.kt b/test/src/test/kotlin/graphql/nadel/tests/next/TestExecutionCapture.kt index 5b7e55641..648095617 100644 --- a/test/src/test/kotlin/graphql/nadel/tests/next/TestExecutionCapture.kt +++ b/test/src/test/kotlin/graphql/nadel/tests/next/TestExecutionCapture.kt @@ -29,7 +29,7 @@ class TestExecutionCapture { val query: String, val variables: JsonMap, val result: JsonMap, - val delayedResults: List, + val delayedResults: List, ) fun capture( @@ -38,7 +38,7 @@ class TestExecutionCapture { variables: JsonMap, result: ExecutionResult, ): ExecutionResult { - val delayedResults = synchronizedMutableListOf() + val delayedResults = synchronizedMutableListOf() _calls.add( Call( @@ -51,7 +51,7 @@ class TestExecutionCapture { ) return spyOnIncrementalResults(result) { - delayedResults.add(it) + delayedResults.add(deepClone(it)) } } @@ -93,6 +93,10 @@ class TestExecutionCapture { return jsonObjectMapper.convertValue(result.toSpecification()!!) } + private fun deepClone(result: DelayedIncrementalPartialResult): JsonMap { + return jsonObjectMapper.convertValue(result.toSpecification()!!) + } + /** * Overrides the default one to mark it as deprecated because you probably * want the synchronized one anyway. diff --git a/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/defer/transforms/DeferredDeepRenameTestSnapshot.kt b/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/defer/transforms/DeferredDeepRenameTestSnapshot.kt index 868c74fc1..cf760df87 100644 --- a/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/defer/transforms/DeferredDeepRenameTestSnapshot.kt +++ b/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/defer/transforms/DeferredDeepRenameTestSnapshot.kt @@ -51,7 +51,10 @@ public class DeferredDeepRenameTestSnapshot : TestSnapshot() { | "path": [], | "data": { | "details": { - | "name": "Issue-1" + | "deep_rename__name__issue": { + | "name": "Issue-1" + | }, + | "__typename__deep_rename__name": "IssueDetail" | } | } | } diff --git a/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/defer/transforms/DeferredFieldIsRenamedTestSnapshot.kt b/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/defer/transforms/DeferredFieldIsRenamedTestSnapshot.kt index 3f8fc8269..3efb5492f 100644 --- a/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/defer/transforms/DeferredFieldIsRenamedTestSnapshot.kt +++ b/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/defer/transforms/DeferredFieldIsRenamedTestSnapshot.kt @@ -55,7 +55,8 @@ public class DeferredFieldIsRenamedTestSnapshot : TestSnapshot() { | "defer" | ], | "data": { - | "overallString": "string for the deferred renamed field" + | "rename__overallString__underlyingString": "string for the deferred renamed field", + | "__typename__rename__overallString": "DeferApi" | } | } | ] diff --git a/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/defer/transforms/DeferredListFieldIsRenamedTestSnapshot.kt b/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/defer/transforms/DeferredListFieldIsRenamedTestSnapshot.kt index d1da355ee..d7265fb25 100644 --- a/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/defer/transforms/DeferredListFieldIsRenamedTestSnapshot.kt +++ b/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/defer/transforms/DeferredListFieldIsRenamedTestSnapshot.kt @@ -54,22 +54,26 @@ public class DeferredListFieldIsRenamedTestSnapshot : TestSnapshot() { | { | "key": "GQLGW-1", | "assigneeId": "ari:cloud:identity::user/1", - | "awesomeIssueName": "Issue 1" + | "rename__awesomeIssueName__title": "Issue 1", + | "__typename__rename__awesomeIssueName": "Issue" | }, | { | "key": "GQLGW-2", | "assigneeId": "ari:cloud:identity::user/2", - | "awesomeIssueName": "Issue 2" + | "rename__awesomeIssueName__title": "Issue 2", + | "__typename__rename__awesomeIssueName": "Issue" | }, | { | "key": "GQLGW-3", | "assigneeId": "ari:cloud:identity::user/1", - | "awesomeIssueName": "Issue 3" + | "rename__awesomeIssueName__title": "Issue 3", + | "__typename__rename__awesomeIssueName": "Issue" | }, | { | "key": "GQLGW-4", | "assigneeId": "ari:cloud:identity::user/3", - | "awesomeIssueName": null + | "rename__awesomeIssueName__title": null, + | "__typename__rename__awesomeIssueName": "Issue" | } | ] | } diff --git a/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/defer/transforms/MultipleRenameTransformsInsideAndOutsideDeferSnapshot.kt b/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/defer/transforms/MultipleRenameTransformsInsideAndOutsideDeferSnapshot.kt index 0367d8d9a..4100646f1 100644 --- a/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/defer/transforms/MultipleRenameTransformsInsideAndOutsideDeferSnapshot.kt +++ b/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/defer/transforms/MultipleRenameTransformsInsideAndOutsideDeferSnapshot.kt @@ -57,7 +57,8 @@ public class MultipleRenameTransformsInsideAndOutsideDeferSnapshot : TestSnapsho | "defer" | ], | "data": { - | "slowRenamedString": "this is the slow string (deferred)" + | "rename__slowRenamedString__slowString": "this is the slow string (deferred)", + | "__typename__rename__slowRenamedString": "DeferApi" | } | } | ] diff --git a/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/defer/transforms/MultipleRenamedFieldsAreDeferredTogetherSnapshot.kt b/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/defer/transforms/MultipleRenamedFieldsAreDeferredTogetherSnapshot.kt index 91e4c7451..b6bb95d64 100644 --- a/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/defer/transforms/MultipleRenamedFieldsAreDeferredTogetherSnapshot.kt +++ b/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/defer/transforms/MultipleRenamedFieldsAreDeferredTogetherSnapshot.kt @@ -57,8 +57,10 @@ public class MultipleRenamedFieldsAreDeferredTogetherSnapshot : TestSnapshot() { | "defer" | ], | "data": { - | "overallString": "deferred string 1", - | "overallString2": "deferred string 2" + | "__typename__rename__overallString2": "DeferApi", + | "rename__overallString2__underlyingString2": "deferred string 2", + | "rename__overallString__underlyingString": "deferred string 1", + | "__typename__rename__overallString": "DeferApi" | } | } | ] diff --git a/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/defer/transforms/MultipleSeparateDefersWithTransformsSnapshot.kt b/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/defer/transforms/MultipleSeparateDefersWithTransformsSnapshot.kt index de6be970b..45a621d97 100644 --- a/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/defer/transforms/MultipleSeparateDefersWithTransformsSnapshot.kt +++ b/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/defer/transforms/MultipleSeparateDefersWithTransformsSnapshot.kt @@ -61,7 +61,8 @@ public class MultipleSeparateDefersWithTransformsSnapshot : TestSnapshot() { | "defer" | ], | "data": { - | "slowRenamedString": "this is the slow string (deferred)" + | "rename__slowRenamedString__slowString": "this is the slow string (deferred)", + | "__typename__rename__slowRenamedString": "DeferApi" | } | } | ] @@ -76,7 +77,8 @@ public class MultipleSeparateDefersWithTransformsSnapshot : TestSnapshot() { | "defer" | ], | "data": { - | "anotherSlowRenamedString": "this is the other slow string (deferred)" + | "rename__anotherSlowRenamedString__anotherSlowString": "this is the other slow string (deferred)", + | "__typename__rename__anotherSlowRenamedString": "DeferApi" | } | } | ] diff --git a/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/defer/transforms/RenameInnerFieldInsideDeferSnapshot.kt b/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/defer/transforms/RenameInnerFieldInsideDeferSnapshot.kt index 99889e1ba..fc041acdd 100644 --- a/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/defer/transforms/RenameInnerFieldInsideDeferSnapshot.kt +++ b/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/defer/transforms/RenameInnerFieldInsideDeferSnapshot.kt @@ -55,7 +55,8 @@ public class RenameInnerFieldInsideDeferSnapshot : TestSnapshot() { | ], | "data": { | "user": { - | "firstName": "Steven" + | "rename__firstName__name": "Steven", + | "__typename__rename__firstName": "User" | } | } | } diff --git a/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/defer/transforms/RenamedTypeIsDeferredTestSnapshot.kt b/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/defer/transforms/RenamedTypeIsDeferredTestSnapshot.kt index 4941a1150..1fccbd342 100644 --- a/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/defer/transforms/RenamedTypeIsDeferredTestSnapshot.kt +++ b/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/defer/transforms/RenamedTypeIsDeferredTestSnapshot.kt @@ -65,7 +65,7 @@ public class RenamedTypeIsDeferredTestSnapshot : TestSnapshot() { | "cat" | ], | "data": { - | "__typename": "Cat" + | "__typename": "Rat" | } | } | ] @@ -82,7 +82,7 @@ public class RenamedTypeIsDeferredTestSnapshot : TestSnapshot() { | "data": { | "monkey": { | "name": "Harambe", - | "__typename": "Monkey" + | "__typename": "Donkey" | } | } | } diff --git a/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/hydration/defer/HydrationRenamedFieldInDeferTestSnapshot.kt b/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/hydration/defer/HydrationRenamedFieldInDeferTestSnapshot.kt index a1c9b8b80..de79cdd7f 100644 --- a/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/hydration/defer/HydrationRenamedFieldInDeferTestSnapshot.kt +++ b/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/hydration/defer/HydrationRenamedFieldInDeferTestSnapshot.kt @@ -49,11 +49,10 @@ public class HydrationRenamedFieldInDeferTestSnapshot : TestSnapshot() { | { | "path": [], | "data": { - | "issueByKey": { + | "rename__issueByKey__getIssueByKey": { | "key": "GQLGW-1", - | "assignee": { - | "name": "Franklin" - | } + | "hydration__assignee__assigneeId": "ari:cloud:identity::user/1", + | "__typename__hydration__assignee": "Issue" | } | } | }