Skip to content

Commit 822c028

Browse files
committed
Update instrospector tests for driver v6
1 parent 7479c7e commit 822c028

File tree

3 files changed

+41
-41
lines changed

3 files changed

+41
-41
lines changed

packages/introspector/tests/integration/graphql/graphs.test.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ describe("GraphQL - Infer Schema on graphs", () => {
3434
driver = await createDriver();
3535
const cSession = driver.session({ defaultAccessMode: neo4j.session.WRITE });
3636
try {
37-
await cSession.writeTransaction((tx) => tx.run(`CREATE DATABASE ${dbName} WAIT`));
37+
await cSession.executeWrite((tx) => tx.run(`CREATE DATABASE ${dbName} WAIT`));
3838
} catch (e) {
3939
if (e instanceof Error) {
4040
if (
@@ -53,7 +53,7 @@ describe("GraphQL - Infer Schema on graphs", () => {
5353
const waitSession = driver.session({
5454
defaultAccessMode: neo4j.session.READ,
5555
database: dbName,
56-
bookmarks: cSession.lastBookmark(),
56+
bookmarks: cSession.lastBookmarks(),
5757
});
5858
await cSession.close();
5959
await waitSession.close();
@@ -69,7 +69,7 @@ describe("GraphQL - Infer Schema on graphs", () => {
6969
if (MULTIDB_SUPPORT) {
7070
const cSession = driver.session({ defaultAccessMode: neo4j.session.WRITE });
7171
try {
72-
await cSession.writeTransaction((tx) => tx.run(`DROP DATABASE ${dbName}`));
72+
await cSession.executeWrite((tx) => tx.run(`DROP DATABASE ${dbName}`));
7373
} catch (e) {
7474
// ignore
7575
}
@@ -86,7 +86,7 @@ describe("GraphQL - Infer Schema on graphs", () => {
8686

8787
const nodeProperties = { title: "Forrest Gump", name: "Glenn Hysén" };
8888
const wSession = driver.session({ defaultAccessMode: neo4j.session.WRITE, database: dbName });
89-
await wSession.writeTransaction((tx) =>
89+
await wSession.executeWrite((tx) =>
9090
tx.run(
9191
`CREATE (m:Movie {title: $props.title})
9292
CREATE (a:Actor {name: $props.name})
@@ -95,7 +95,7 @@ describe("GraphQL - Infer Schema on graphs", () => {
9595
{ props: nodeProperties }
9696
)
9797
);
98-
const bm = wSession.lastBookmark();
98+
const bm = wSession.lastBookmarks();
9999
await wSession.close();
100100

101101
const typeDefs = await toGraphQLTypeDefs(sessionFactory(bm));
@@ -125,7 +125,7 @@ describe("GraphQL - Infer Schema on graphs", () => {
125125

126126
const nodeProperties = { title: "Forrest Gump", name: "Glenn Hysén" };
127127
const wSession = driver.session({ defaultAccessMode: neo4j.session.WRITE, database: dbName });
128-
await wSession.writeTransaction((tx) =>
128+
await wSession.executeWrite((tx) =>
129129
tx.run(
130130
`CREATE (m:Movie {title: $props.title})
131131
CREATE (p:Play:Theater {title: $props.title})
@@ -139,7 +139,7 @@ describe("GraphQL - Infer Schema on graphs", () => {
139139
{ props: nodeProperties }
140140
)
141141
);
142-
const bm = wSession.lastBookmark();
142+
const bm = wSession.lastBookmarks();
143143
await wSession.close();
144144

145145
const typeDefs = await toGraphQLTypeDefs(sessionFactory(bm));
@@ -193,7 +193,7 @@ describe("GraphQL - Infer Schema on graphs", () => {
193193
screenTime: new neo4j.Duration(0, 0, 3600, 0),
194194
};
195195
const wSession = driver.session({ defaultAccessMode: neo4j.session.WRITE, database: dbName });
196-
await wSession.writeTransaction((tx) =>
196+
await wSession.executeWrite((tx) =>
197197
tx.run(
198198
`CREATE (m:Movie {title: $props.title, screenTime: $props.screenTime})
199199
CREATE (a:Actor {name: $props.name})
@@ -206,7 +206,7 @@ describe("GraphQL - Infer Schema on graphs", () => {
206206
{ props: nodeProperties }
207207
)
208208
);
209-
const bm = wSession.lastBookmark();
209+
const bm = wSession.lastBookmarks();
210210
await wSession.close();
211211

212212
const typeDefs = await toGraphQLTypeDefs(sessionFactory(bm));
@@ -253,7 +253,7 @@ describe("GraphQL - Infer Schema on graphs", () => {
253253
roles: ["Footballer", "Drunken man on the street"],
254254
};
255255
const wSession = driver.session({ defaultAccessMode: neo4j.session.WRITE, database: dbName });
256-
await wSession.writeTransaction((tx) =>
256+
await wSession.executeWrite((tx) =>
257257
tx.run(
258258
`CREATE (m:\`Movie-Label\` {title: $props.title})
259259
CREATE (a:\`Actor-Label\` {name: $props.name})
@@ -263,7 +263,7 @@ describe("GraphQL - Infer Schema on graphs", () => {
263263
{ props: nodeProperties }
264264
)
265265
);
266-
const bm = wSession.lastBookmark();
266+
const bm = wSession.lastBookmarks();
267267
await wSession.close();
268268

269269
const typeDefs = await toGraphQLTypeDefs(sessionFactory(bm));

packages/introspector/tests/integration/graphql/label-injection.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
* limitations under the License.
1818
*/
1919

20-
import * as neo4j from "neo4j-driver";
2120
import { Neo4jGraphQL } from "@neo4j/graphql";
21+
import * as neo4j from "neo4j-driver";
2222
import { toGraphQLTypeDefs } from "../../../src/index";
2323
import createDriver from "../neo4j";
2424

@@ -34,7 +34,7 @@ describe("GraphQL - Infer Schema on graphs", () => {
3434
driver = await createDriver();
3535
const cSession = driver.session({ defaultAccessMode: neo4j.session.WRITE });
3636
try {
37-
await cSession.writeTransaction((tx) => tx.run(`CREATE DATABASE ${dbName} WAIT`));
37+
await cSession.executeWrite((tx) => tx.run(`CREATE DATABASE ${dbName} WAIT`));
3838
} catch (e) {
3939
if (e instanceof Error) {
4040
if (
@@ -53,7 +53,7 @@ describe("GraphQL - Infer Schema on graphs", () => {
5353
const waitSession = driver.session({
5454
defaultAccessMode: neo4j.session.READ,
5555
database: dbName,
56-
bookmarks: cSession.lastBookmark(),
56+
bookmarks: cSession.lastBookmarks(),
5757
});
5858
await cSession.close();
5959
await waitSession.close();
@@ -69,7 +69,7 @@ describe("GraphQL - Infer Schema on graphs", () => {
6969
if (MULTIDB_SUPPORT) {
7070
const cSession = driver.session({ defaultAccessMode: neo4j.session.WRITE });
7171
try {
72-
await cSession.writeTransaction((tx) => tx.run(`DROP DATABASE ${dbName}`));
72+
await cSession.executeWrite((tx) => tx.run(`DROP DATABASE ${dbName}`));
7373
} catch (e) {
7474
// ignore
7575
}
@@ -85,10 +85,10 @@ describe("GraphQL - Infer Schema on graphs", () => {
8585
}
8686

8787
const wSession = driver.session({ defaultAccessMode: neo4j.session.WRITE, database: dbName });
88-
await wSession.writeTransaction((tx) =>
88+
await wSession.executeWrite((tx) =>
8989
tx.run("CREATE (a:Wurst) -[:```MATCH (n) DETACH DELETE n //`] -> (:Salat)")
9090
);
91-
const bm = wSession.lastBookmark();
91+
const bm = wSession.lastBookmarks();
9292
await wSession.close();
9393

9494
const typeDefs = await toGraphQLTypeDefs(sessionFactory(bm));

packages/introspector/tests/integration/graphql/nodes.test.ts

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
* limitations under the License.
1818
*/
1919

20-
import * as neo4j from "neo4j-driver";
2120
import { Neo4jGraphQL } from "@neo4j/graphql";
21+
import * as neo4j from "neo4j-driver";
2222
import { toGraphQLTypeDefs } from "../../../src/index";
2323
import createDriver from "../neo4j";
2424

@@ -34,7 +34,7 @@ describe("GraphQL - Infer Schema nodes basic tests", () => {
3434
driver = await createDriver();
3535
const cSession = driver.session({ defaultAccessMode: neo4j.session.WRITE });
3636
try {
37-
await cSession.writeTransaction((tx) => tx.run(`CREATE DATABASE ${dbName} WAIT`));
37+
await cSession.executeWrite((tx) => tx.run(`CREATE DATABASE ${dbName} WAIT`));
3838
} catch (e) {
3939
if (e instanceof Error) {
4040
if (
@@ -53,7 +53,7 @@ describe("GraphQL - Infer Schema nodes basic tests", () => {
5353
const waitSession = driver.session({
5454
defaultAccessMode: neo4j.session.READ,
5555
database: dbName,
56-
bookmarks: cSession.lastBookmark(),
56+
bookmarks: cSession.lastBookmarks(),
5757
});
5858
await cSession.close();
5959
await waitSession.close();
@@ -69,7 +69,7 @@ describe("GraphQL - Infer Schema nodes basic tests", () => {
6969
if (MULTIDB_SUPPORT) {
7070
const cSession = driver.session({ defaultAccessMode: neo4j.session.WRITE });
7171
try {
72-
await cSession.writeTransaction((tx) => tx.run(`DROP DATABASE ${dbName}`));
72+
await cSession.executeWrite((tx) => tx.run(`DROP DATABASE ${dbName}`));
7373
} catch (e) {
7474
// ignore
7575
}
@@ -85,10 +85,10 @@ describe("GraphQL - Infer Schema nodes basic tests", () => {
8585

8686
const nodeProperty = "testString";
8787
const wSession = driver.session({ defaultAccessMode: neo4j.session.WRITE, database: dbName });
88-
await wSession.writeTransaction((tx) =>
88+
await wSession.executeWrite((tx) =>
8989
tx.run("CREATE (:TestLabel {nodeProperty: $prop})", { prop: nodeProperty })
9090
);
91-
const bm = wSession.lastBookmark();
91+
const bm = wSession.lastBookmarks();
9292
await wSession.close();
9393

9494
const typeDefs = await toGraphQLTypeDefs(sessionFactory(bm));
@@ -112,13 +112,13 @@ describe("GraphQL - Infer Schema nodes basic tests", () => {
112112

113113
const nodeProperties = { str: "testString", int: neo4j.int(42), number: 80, strArr: ["Stella", "Molly"] };
114114
const wSession = driver.session({ defaultAccessMode: neo4j.session.WRITE, database: dbName });
115-
await wSession.writeTransaction((tx) =>
115+
await wSession.executeWrite((tx) =>
116116
tx.run(
117117
"CREATE (:TestLabel {strProp: $props.str, intProp: $props.int, numberProp: $props.number, strArrProp: $props.strArr})",
118118
{ props: nodeProperties }
119119
)
120120
);
121-
const bm = wSession.lastBookmark();
121+
const bm = wSession.lastBookmarks();
122122
await wSession.close();
123123

124124
const typeDefs = await toGraphQLTypeDefs(sessionFactory(bm));
@@ -145,14 +145,14 @@ describe("GraphQL - Infer Schema nodes basic tests", () => {
145145

146146
const nodeProperties = { first: "testString", second: neo4j.int(42) };
147147
const wSession = driver.session({ defaultAccessMode: neo4j.session.WRITE, database: dbName });
148-
await wSession.writeTransaction((tx) =>
148+
await wSession.executeWrite((tx) =>
149149
tx.run(
150150
`CREATE (:TestLabel {strProp: $props.first})
151151
CREATE (:TestLabel2 {singleProp: $props.second})`,
152152
{ props: nodeProperties }
153153
)
154154
);
155-
const bm = wSession.lastBookmark();
155+
const bm = wSession.lastBookmarks();
156156
await wSession.close();
157157

158158
const typeDefs = await toGraphQLTypeDefs(sessionFactory(bm));
@@ -180,14 +180,14 @@ describe("GraphQL - Infer Schema nodes basic tests", () => {
180180

181181
const nodeProperties = { first: "testString", second: neo4j.int(42) };
182182
const wSession = driver.session({ defaultAccessMode: neo4j.session.WRITE, database: dbName });
183-
await wSession.writeTransaction((tx) =>
183+
await wSession.executeWrite((tx) =>
184184
tx.run(
185185
`CREATE (:TestLabel {strProp: $props.first})
186186
CREATE (:TestLabel2:TestLabel3 {singleProp: $props.second})`,
187187
{ props: nodeProperties }
188188
)
189189
);
190-
const bm = wSession.lastBookmark();
190+
const bm = wSession.lastBookmarks();
191191
await wSession.close();
192192

193193
const typeDefs = await toGraphQLTypeDefs(sessionFactory(bm));
@@ -215,13 +215,13 @@ describe("GraphQL - Infer Schema nodes basic tests", () => {
215215

216216
const nodeProperties = { first: "testString", second: neo4j.int(42) };
217217
const wSession = driver.session({ defaultAccessMode: neo4j.session.WRITE, database: dbName });
218-
await wSession.writeTransaction((tx) =>
218+
await wSession.executeWrite((tx) =>
219219
tx.run(
220220
"CREATE (:`Test``Label` {strProp: $props.first}) CREATE (:`Test-Label` {singleProp: $props.second})",
221221
{ props: nodeProperties }
222222
)
223223
);
224-
const bm = wSession.lastBookmark();
224+
const bm = wSession.lastBookmarks();
225225
await wSession.close();
226226

227227
const typeDefs = await toGraphQLTypeDefs(sessionFactory(bm));
@@ -249,8 +249,8 @@ describe("GraphQL - Infer Schema nodes basic tests", () => {
249249
}
250250

251251
const wSession = driver.session({ defaultAccessMode: neo4j.session.WRITE, database: dbName });
252-
await wSession.writeTransaction((tx) => tx.run("CREATE (:`2number` {prop: 1})"));
253-
const bm = wSession.lastBookmark();
252+
await wSession.executeWrite((tx) => tx.run("CREATE (:`2number` {prop: 1})"));
253+
const bm = wSession.lastBookmarks();
254254
await wSession.close();
255255

256256
const typeDefs = await toGraphQLTypeDefs(sessionFactory(bm));
@@ -274,7 +274,7 @@ describe("GraphQL - Infer Schema nodes basic tests", () => {
274274

275275
const nodeProperties = { str: "testString", int: neo4j.int(42) };
276276
const wSession = driver.session({ defaultAccessMode: neo4j.session.WRITE, database: dbName });
277-
await wSession.writeTransaction((tx) =>
277+
await wSession.executeWrite((tx) =>
278278
tx.run(
279279
`CREATE (:FullNode {amb: $props.str, str: $props.str})
280280
CREATE (:FullNode {amb: $props.int, str: $props.str})
@@ -284,7 +284,7 @@ describe("GraphQL - Infer Schema nodes basic tests", () => {
284284
{ props: nodeProperties }
285285
)
286286
);
287-
const bm = wSession.lastBookmark();
287+
const bm = wSession.lastBookmarks();
288288
await wSession.close();
289289

290290
const typeDefs = await toGraphQLTypeDefs(sessionFactory(bm));
@@ -307,10 +307,10 @@ describe("GraphQL - Infer Schema nodes basic tests", () => {
307307
}
308308

309309
const wSession = driver.session({ defaultAccessMode: neo4j.session.WRITE, database: dbName });
310-
await wSession.writeTransaction((tx) =>
310+
await wSession.executeWrite((tx) =>
311311
tx.run("CREATE ({prop: 1}) CREATE ({prop: 2}) CREATE (:EmptyNode) CREATE (:FullNode {prop: 1})")
312312
);
313-
const bm = wSession.lastBookmark();
313+
const bm = wSession.lastBookmarks();
314314
await wSession.close();
315315

316316
const typeDefs = await toGraphQLTypeDefs(sessionFactory(bm));
@@ -333,8 +333,8 @@ describe("GraphQL - Infer Schema nodes basic tests", () => {
333333
}
334334

335335
const wSession = driver.session({ defaultAccessMode: neo4j.session.WRITE, database: dbName });
336-
await wSession.writeTransaction((tx) => tx.run("CREATE (:EmptyNode)-[:RELATIONSHIP]->(:FullNode {prop: 1})"));
337-
const bm = wSession.lastBookmark();
336+
await wSession.executeWrite((tx) => tx.run("CREATE (:EmptyNode)-[:RELATIONSHIP]->(:FullNode {prop: 1})"));
337+
const bm = wSession.lastBookmarks();
338338
await wSession.close();
339339

340340
const typeDefs = await toGraphQLTypeDefs(sessionFactory(bm));
@@ -363,14 +363,14 @@ describe("GraphQL - Infer Schema nodes basic tests", () => {
363363

364364
const nodeProperties = { first: "testString", second: neo4j.int(42) };
365365
const wSession = driver.session({ defaultAccessMode: neo4j.session.WRITE, database: dbName });
366-
await wSession.writeTransaction((tx) =>
366+
await wSession.executeWrite((tx) =>
367367
tx.run(
368368
`CREATE (:TestLabel {strProp: $props.first})
369369
CREATE (:TestLabel2:TestLabel3 {singleProp: $props.second})`,
370370
{ props: nodeProperties }
371371
)
372372
);
373-
const bm = wSession.lastBookmark();
373+
const bm = wSession.lastBookmarks();
374374
await wSession.close();
375375

376376
const typeDefs = await toGraphQLTypeDefs(sessionFactory(bm), true);

0 commit comments

Comments
 (0)