You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: normalized-cache-apollo-compiler-plugin/src/main/kotlin/com/apollographql/cache/apollocompilerplugin/internal/AddKeyFieldsDocumentTransform.kt
Copy file name to clipboardExpand all lines: normalized-cache-apollo-compiler-plugin/src/main/kotlin/com/apollographql/cache/apollocompilerplugin/internal/getTypePolicies.kt
Copy file name to clipboardExpand all lines: normalized-cache-apollo-compiler-plugin/src/test/kotlin/com/apollographql/cache/apollocompilerplugin/internal/GetTypePoliciesTest.kt
+37-6Lines changed: 37 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -58,12 +58,43 @@ class GetTypePoliciesTest {
58
58
).getOrThrow()
59
59
60
60
val expected =mapOf(
61
-
"User" to TypePolicy(keyFields =setOf("id"), embeddedFields = emptySet()),
62
-
"Animal" to TypePolicy(keyFields =setOf("kingdom", "species"), embeddedFields = emptySet()),
63
-
"Lion" to TypePolicy(keyFields =setOf("kingdom", "species"), embeddedFields = emptySet()),
64
-
"HasId" to TypePolicy(keyFields =setOf("id"), embeddedFields = emptySet()),
65
-
"Circle" to TypePolicy(keyFields =setOf("id"), embeddedFields = emptySet()),
66
-
"Square" to TypePolicy(keyFields =setOf("radius"), embeddedFields = emptySet()),
61
+
"User" to TypePolicy(keyFields = sortedSetOf("id"), embeddedFields = emptySet()),
62
+
"Animal" to TypePolicy(keyFields = sortedSetOf("kingdom", "species"), embeddedFields = emptySet()),
63
+
"Lion" to TypePolicy(keyFields = sortedSetOf("kingdom", "species"), embeddedFields = emptySet()),
64
+
"HasId" to TypePolicy(keyFields = sortedSetOf("id"), embeddedFields = emptySet()),
65
+
"Circle" to TypePolicy(keyFields = sortedSetOf("id"), embeddedFields = emptySet()),
66
+
"Square" to TypePolicy(keyFields = sortedSetOf("radius"), embeddedFields = emptySet()),
67
+
)
68
+
69
+
assertEquals(expected, schema.getTypePolicies())
70
+
}
71
+
72
+
@Test
73
+
funensureTypePolicyKeyFieldsAreSorted() {
74
+
// language=GraphQL
75
+
val schema ="""
76
+
type Query {
77
+
animal: Animal
78
+
}
79
+
80
+
type Animal @typePolicy(keyFields: "kingdom species genus class domain") {
0 commit comments