Skip to content

Commit d5f89cb

Browse files
authored
Add test case for #65. (#177)
The reported bug is already fixed
1 parent fb9ab3a commit d5f89cb

File tree

3 files changed

+93
-1
lines changed

3 files changed

+93
-1
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<component name="ProjectRunConfigurationManager">
2+
<configuration default="false" name="Run All tests including integration tests" type="JUnit" factoryName="JUnit">
3+
<module name="neo4j-graphql-java" />
4+
<option name="PACKAGE_NAME" value="org.neo4j.graphql" />
5+
<option name="MAIN_CLASS_NAME" value="" />
6+
<option name="METHOD_NAME" value="" />
7+
<option name="TEST_OBJECT" value="package" />
8+
<option name="VM_PARAMETERS" value="-ea -Dneo4j-graphql-java.integration-tests=true" />
9+
<uniqueIds>
10+
<uniqueId value="[engine:junit-jupiter]/[class:org.neo4j.graphql.CypherTests]" />
11+
</uniqueIds>
12+
<method v="2">
13+
<option name="Make" enabled="true" />
14+
</method>
15+
</configuration>
16+
</component>

core/src/test/kotlin/org/neo4j/graphql/IssuesTests.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package demo.org.neo4j.graphql
1+
package org.neo4j.graphql
22

33
import org.junit.jupiter.api.DynamicContainer
44
import org.junit.jupiter.api.DynamicNode
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
:toc:
2+
3+
= Github Issue #65: Filtering on children through parent fields generates logically invalid cypher
4+
5+
== Schema
6+
7+
[source,graphql,schema=true]
8+
----
9+
type SurveyTemplate{
10+
uid: ID!
11+
responses: [SurveyResponse] @relation(name: "SURVEY_RESPONSE", direction: OUT)
12+
}
13+
14+
type SurveyResponse{
15+
uid: ID!
16+
surveyTemplate: SurveyTemplate @relation(name: "SURVEY_RESPONSE", direction: IN)
17+
}
18+
----
19+
20+
== Test Data
21+
22+
[source,cypher,test-data=true]
23+
----
24+
CREATE (tA:SurveyTemplate{ uid: 'a' })
25+
CREATE (tB:SurveyTemplate{ uid: 'b' })
26+
CREATE (tC:SurveyTemplate{ uid: 'c' })
27+
CREATE (rX:SurveyResponse{ uid: 'x' })
28+
CREATE (rY:SurveyResponse{ uid: 'y' })
29+
CREATE (rZ:SurveyResponse{ uid: 'z' })
30+
CREATE (tA)-[:SURVEY_RESPONSE]->(rX)
31+
CREATE (tA)-[:SURVEY_RESPONSE]->(rY)
32+
CREATE (tB)-[:SURVEY_RESPONSE]->(rX);
33+
----
34+
35+
== Issue
36+
37+
.GraphQL-Query
38+
[source,graphql]
39+
----
40+
{
41+
surveyResponse(filter: {surveyTemplate: {uid: "a"}}){
42+
uid
43+
}
44+
}
45+
----
46+
47+
.GraphQL-Response
48+
[source,json,response=true]
49+
----
50+
{
51+
"surveyResponse" : [ {
52+
"uid" : "x"
53+
}, {
54+
"uid" : "y"
55+
} ]
56+
}
57+
----
58+
59+
.Cypher Params
60+
[source,json]
61+
----
62+
{
63+
"filterSurveyResponseSurveyTemplateUid" : "a"
64+
}
65+
----
66+
67+
.Cypher
68+
[source,cypher]
69+
----
70+
MATCH (surveyResponse:SurveyResponse)
71+
WHERE any(filterSurveyResponseSurveyTemplateCond IN [(surveyResponse)<-[:SURVEY_RESPONSE]-(filterSurveyResponseSurveyTemplate:SurveyTemplate) | filterSurveyResponseSurveyTemplate.uid = $filterSurveyResponseSurveyTemplateUid]
72+
WHERE filterSurveyResponseSurveyTemplateCond)
73+
RETURN surveyResponse {
74+
.uid
75+
} AS surveyResponse
76+
----

0 commit comments

Comments
 (0)