-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add IT (currently failing) wait for #206 to be merged
- Loading branch information
Showing
1 changed file
with
84 additions
and
0 deletions.
There are no files selected for viewing
84 changes: 84 additions & 0 deletions
84
core/src/test/resources/issues/gh-190-cypher-directive-with-passThrough.adoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
:toc: | ||
|
||
= Github Issue #190: cypher directive with passThrough | ||
|
||
== Schema | ||
|
||
[source,graphql,schema=true] | ||
---- | ||
type Query { | ||
## queriesRootQuery | ||
getUser(userId: ID): UserData | ||
@cypher(statement: "MATCH (u:User{id: $userId})-[:CREATED_MAP]->(m:Map) WITH collect({id: m.id, name: m.name}) AS mapsCreated, u RETURN {name: u.name, mapsCreated: mapsCreated}", passThrough:true) | ||
} | ||
type UserData { | ||
name: String | ||
mapsCreated: [MapsCreated] | ||
} | ||
type MapsCreated { | ||
id: String | ||
name: String | ||
} | ||
---- | ||
|
||
[source,cypher,test-data=true] | ||
---- | ||
CREATE | ||
(u1:User{ id: 'u1', name: 'user 1' }), | ||
(u2:User{ id: 'u2', name: 'user 2' }), | ||
(m1:Map{ id: 'm1', name: 'v1' }), | ||
(m2:Map{ id: 'm2', name: 'v2' }), | ||
(m3:Map{ id: 'm3', name: 'v3' }), | ||
(u1)-[:CREATED_MAP]->(m1), | ||
(u1)-[:CREATED_MAP]->(m2), | ||
(u2)-[:CREATED_MAP]->(m3); | ||
---- | ||
|
||
== Tests | ||
|
||
=== Query projected data | ||
|
||
.GraphQL-Query | ||
[source,graphql] | ||
---- | ||
query getUser { | ||
user: getUser(userId: "u1") { | ||
name | ||
mapsCreated { id } | ||
} | ||
} | ||
---- | ||
|
||
.Cypher Params | ||
[source,json] | ||
---- | ||
{ | ||
"userUserId" : "u1" | ||
} | ||
---- | ||
|
||
.GraphQL-Response | ||
[source,json,response=true] | ||
---- | ||
{ | ||
"user" : { | ||
"mapsCreated" : [ { | ||
"id" : "m2" | ||
}, { | ||
"id" : "m1" | ||
} ], | ||
"name" : "user 1" | ||
} | ||
} | ||
---- | ||
|
||
.Cypher | ||
[source,cypher] | ||
---- | ||
UNWIND apoc.cypher.runFirstColumnSingle('WITH $userId AS userId MATCH (u:User{id: $userId})-[:CREATED_MAP]->(m:Map) WITH collect({id: m.id, name: m.name}) AS mapsCreated, u RETURN {name: u.name, mapsCreated: mapsCreated}', { | ||
userId: $userUserId | ||
}) AS user | ||
RETURN user AS user | ||
---- |