@@ -71,138 +71,6 @@ describe("CypherBuilder Call", () => {
7171 ` ) ;
7272 } ) ;
7373
74- test ( "CALL with import with" , ( ) => {
75- const node = new Cypher . Node ( ) ;
76-
77- const matchClause = new Cypher . Match ( new Cypher . Pattern ( node , { labels : [ "Movie" ] } ) )
78- . where ( Cypher . eq ( new Cypher . Param ( "aa" ) , new Cypher . Param ( "bb" ) ) )
79- . return ( [ node . property ( "title" ) , "movie" ] ) ;
80-
81- const clause = new Cypher . Call ( matchClause ) . importWith ( node ) ;
82- const queryResult = clause . build ( ) ;
83- expect ( queryResult . cypher ) . toMatchInlineSnapshot ( `
84- "CALL {
85- WITH this0
86- MATCH (this0:Movie)
87- WHERE $param0 = $param1
88- RETURN this0.title AS movie
89- }"
90- ` ) ;
91-
92- expect ( queryResult . params ) . toMatchInlineSnapshot ( `
93- {
94- "param0": "aa",
95- "param1": "bb",
96- }
97- ` ) ;
98- } ) ;
99-
100- test ( "CALL with import with *" , ( ) => {
101- const node = new Cypher . Node ( ) ;
102-
103- const matchClause = new Cypher . Match ( new Cypher . Pattern ( node , { labels : [ "Movie" ] } ) ) . return ( [
104- node . property ( "title" ) ,
105- "movie" ,
106- ] ) ;
107-
108- const clause = new Cypher . Call ( matchClause ) . importWith ( "*" ) ;
109- const queryResult = clause . build ( ) ;
110- expect ( queryResult . cypher ) . toMatchInlineSnapshot ( `
111- "CALL {
112- WITH *
113- MATCH (this0:Movie)
114- RETURN this0.title AS movie
115- }"
116- ` ) ;
117-
118- expect ( queryResult . params ) . toMatchInlineSnapshot ( `{}` ) ;
119- } ) ;
120-
121- test ( "CALL with import with * and extra fields" , ( ) => {
122- const node = new Cypher . Node ( ) ;
123-
124- const matchClause = new Cypher . Match ( new Cypher . Pattern ( node , { labels : [ "Movie" ] } ) ) . return ( [
125- node . property ( "title" ) ,
126- "movie" ,
127- ] ) ;
128-
129- const clause = new Cypher . Call ( matchClause ) . importWith ( node , "*" ) ;
130- const queryResult = clause . build ( ) ;
131- expect ( queryResult . cypher ) . toMatchInlineSnapshot ( `
132- "CALL {
133- WITH *, this0
134- MATCH (this0:Movie)
135- RETURN this0.title AS movie
136- }"
137- ` ) ;
138-
139- expect ( queryResult . params ) . toMatchInlineSnapshot ( `{}` ) ;
140- } ) ;
141-
142- test ( "CALL with import with without parameters" , ( ) => {
143- const node = new Cypher . Node ( ) ;
144-
145- const matchClause = new Cypher . Match ( new Cypher . Pattern ( node , { labels : [ "Movie" ] } ) )
146- . where ( Cypher . eq ( new Cypher . Param ( "aa" ) , new Cypher . Param ( "bb" ) ) )
147- . return ( [ node . property ( "title" ) , "movie" ] ) ;
148-
149- const clause = new Cypher . Call ( matchClause ) . importWith ( ) ;
150- const queryResult = clause . build ( ) ;
151- expect ( queryResult . cypher ) . toMatchInlineSnapshot ( `
152- "CALL {
153- MATCH (this0:Movie)
154- WHERE $param0 = $param1
155- RETURN this0.title AS movie
156- }"
157- ` ) ;
158-
159- expect ( queryResult . params ) . toMatchInlineSnapshot ( `
160- {
161- "param0": "aa",
162- "param1": "bb",
163- }
164- ` ) ;
165- } ) ;
166-
167- test ( "CALL with import with multiple parameters" , ( ) => {
168- const node = new Cypher . Node ( ) ;
169-
170- const matchClause = new Cypher . Match ( new Cypher . Pattern ( node , { labels : [ "Movie" ] } ) )
171- . where ( Cypher . eq ( new Cypher . Param ( "aa" ) , new Cypher . Param ( "bb" ) ) )
172- . return ( [ node . property ( "title" ) , "movie" ] ) ;
173-
174- const clause = new Cypher . Call ( matchClause ) . importWith ( node , new Cypher . Variable ( ) ) ;
175- const queryResult = clause . build ( ) ;
176- expect ( queryResult . cypher ) . toMatchInlineSnapshot ( `
177- "CALL {
178- WITH this0, var1
179- MATCH (this0:Movie)
180- WHERE $param0 = $param1
181- RETURN this0.title AS movie
182- }"
183- ` ) ;
184-
185- expect ( queryResult . params ) . toMatchInlineSnapshot ( `
186- {
187- "param0": "aa",
188- "param1": "bb",
189- }
190- ` ) ;
191- } ) ;
192-
193- test ( "CALL with import with fails if import with is already set" , ( ) => {
194- const node = new Cypher . Node ( ) ;
195-
196- const matchClause = new Cypher . Match ( new Cypher . Pattern ( node , { labels : [ "Movie" ] } ) )
197- . where ( Cypher . eq ( new Cypher . Param ( "aa" ) , new Cypher . Param ( "bb" ) ) )
198- . return ( [ node . property ( "title" ) , "movie" ] ) ;
199-
200- const clause = new Cypher . Call ( matchClause ) . importWith ( node ) ;
201- expect ( ( ) => {
202- clause . importWith ( node ) ;
203- } ) . toThrow ( `Call import "WITH" already set` ) ;
204- } ) ;
205-
20674 test ( "CALL with external with" , ( ) => {
20775 const node = new Cypher . Node ( ) ;
20876
@@ -700,19 +568,6 @@ RETURN this0"
700568 expect ( queryResult . params ) . toMatchInlineSnapshot ( `{}` ) ;
701569 } ) ;
702570
703- test ( "ImportWith fails when variable scope is set" , ( ) => {
704- const movieNode = new Cypher . Node ( ) ;
705-
706- const call = new Cypher . Call (
707- new Cypher . Create ( new Cypher . Pattern ( movieNode ) . related ( ) . to ( new Cypher . Node ( ) ) ) ,
708- [ movieNode ]
709- ) ;
710-
711- expect ( ( ) => {
712- call . importWith ( "*" ) ;
713- } ) . toThrow ( `Call import cannot be used along with scope clauses "Call (<variable>)"` ) ;
714- } ) ;
715-
716571 test ( "Call with empty variable scope" , ( ) => {
717572 const movieNode = new Cypher . Node ( ) ;
718573 const actorNode = new Cypher . Node ( ) ;
0 commit comments