diff --git a/packages/graphql/tests/integration/array-methods/array-pop-and-push-errors.int.test.ts b/packages/graphql/tests/integration/array-methods/array-pop-and-push-errors.int.test.ts index c170a2ff48..1919dd1892 100644 --- a/packages/graphql/tests/integration/array-methods/array-pop-and-push-errors.int.test.ts +++ b/packages/graphql/tests/integration/array-methods/array-pop-and-push-errors.int.test.ts @@ -17,42 +17,26 @@ * limitations under the License. */ -import { gql } from "graphql-tag"; import type { GraphQLError } from "graphql"; -import { graphql } from "graphql"; -import type { Driver, Session } from "neo4j-driver"; -import { generate } from "randomstring"; +import { gql } from "graphql-tag"; import { IncomingMessage } from "http"; import { Socket } from "net"; - -import { Neo4jGraphQL } from "../../../src/classes"; -import Neo4jHelper from "../neo4j"; -import { UniqueType } from "../../utils/graphql-types"; +import { generate } from "randomstring"; +import { TestHelper } from "../utils/tests-helper"; describe("array-pop-and-push", () => { - let driver: Driver; - let session: Session; - let neo4j: Neo4jHelper; - - beforeAll(async () => { - neo4j = new Neo4jHelper(); - driver = await neo4j.getDriver(); - }); + let testHelper: TestHelper; - afterAll(async () => { - await driver.close(); - }); - - beforeEach(async () => { - session = await neo4j.getSession(); + beforeEach(() => { + testHelper = new TestHelper(); }); afterEach(async () => { - await session.close(); + await testHelper.close(); }); test("should throw an error when trying to pop an element from a non-existing array", async () => { - const typeMovie = new UniqueType("Movie"); + const typeMovie = testHelper.createUniqueType("Movie"); const typeDefs = gql` type ${typeMovie} { @@ -62,7 +46,7 @@ describe("array-pop-and-push", () => { } `; - const neoSchema = new Neo4jGraphQL({ typeDefs }); + await testHelper.initNeo4jGraphQL({ typeDefs }); const movieTitle = generate({ charset: "alphabetic", @@ -84,17 +68,9 @@ describe("array-pop-and-push", () => { CREATE (m:${typeMovie} {title:$movieTitle, tags: ["abc"] }) `; - await session.run(cypher, { movieTitle }); - - const gqlResult = await graphql({ - schema: await neoSchema.getSchema(), - source: update, - contextValue: neo4j.getContextValues(), - }); + await testHelper.runCypher(cypher, { movieTitle }); - if (gqlResult.errors) { - console.log(JSON.stringify(gqlResult.errors, null, 2)); - } + const gqlResult = await testHelper.runGraphQL(update); expect(gqlResult.errors).toBeDefined(); expect( @@ -105,7 +81,7 @@ describe("array-pop-and-push", () => { }); test("should throw an error if not authenticated on field definition", async () => { - const typeMovie = new UniqueType("Movie"); + const typeMovie = testHelper.createUniqueType("Movie"); const typeDefs = ` type ${typeMovie} { title: String @@ -114,7 +90,7 @@ describe("array-pop-and-push", () => { } `; - const neoSchema = new Neo4jGraphQL({ typeDefs, features: { authorization: { key: "secret" } } }); + await testHelper.initNeo4jGraphQL({ typeDefs, features: { authorization: { key: "secret" } } }); const movieTitle = generate({ charset: "alphabetic", @@ -136,7 +112,7 @@ describe("array-pop-and-push", () => { CREATE (m:${typeMovie} {title:$movieTitle, tags: ['a', 'b'], moreTags: []}) `; - await session.run(cypher, { movieTitle }); + await testHelper.runCypher(cypher, { movieTitle }); const token = "not valid token"; @@ -144,11 +120,7 @@ describe("array-pop-and-push", () => { const req = new IncomingMessage(socket); req.headers.authorization = `Bearer ${token}`; - const gqlResult = await graphql({ - schema: await neoSchema.getSchema(), - source: update, - contextValue: neo4j.getContextValues(), - }); + const gqlResult = await testHelper.runGraphQL(update); expect(gqlResult.errors).toBeDefined(); expect((gqlResult.errors as GraphQLError[]).some((el) => el.message.includes("Unauthenticated"))).toBeTruthy(); @@ -156,7 +128,7 @@ describe("array-pop-and-push", () => { }); test("should throw an error when input is invalid", async () => { - const typeMovie = new UniqueType("Movie"); + const typeMovie = testHelper.createUniqueType("Movie"); const typeDefs = gql` type ${typeMovie} { @@ -166,7 +138,7 @@ describe("array-pop-and-push", () => { } `; - const neoSchema = new Neo4jGraphQL({ typeDefs }); + await testHelper.initNeo4jGraphQL({ typeDefs }); const movieTitle = generate({ charset: "alphabetic", @@ -188,13 +160,9 @@ describe("array-pop-and-push", () => { CREATE (m:${typeMovie} {title:$movieTitle, tags: ["abc"], moreTags: ["this", "that", "them"] }) `; - await session.run(cypher, { movieTitle }); + await testHelper.runCypher(cypher, { movieTitle }); - const gqlResult = await graphql({ - schema: await neoSchema.getSchema(), - source: update, - contextValue: neo4j.getContextValues(), - }); + const gqlResult = await testHelper.runGraphQL(update); expect(gqlResult.errors).toBeDefined(); expect( diff --git a/packages/graphql/tests/integration/array-methods/array-pop-and-push.int.test.ts b/packages/graphql/tests/integration/array-methods/array-pop-and-push.int.test.ts index b4f1b60d41..95c099816c 100644 --- a/packages/graphql/tests/integration/array-methods/array-pop-and-push.int.test.ts +++ b/packages/graphql/tests/integration/array-methods/array-pop-and-push.int.test.ts @@ -17,39 +17,23 @@ * limitations under the License. */ -import { graphql } from "graphql"; import { gql } from "graphql-tag"; -import type { Driver, Session } from "neo4j-driver"; import { generate } from "randomstring"; - -import Neo4jHelper from "../neo4j"; -import { Neo4jGraphQL } from "../../../src/classes"; -import { UniqueType } from "../../utils/graphql-types"; +import { TestHelper } from "../utils/tests-helper"; describe("array-pop-and-push", () => { - let driver: Driver; - let session: Session; - let neo4j: Neo4jHelper; - - beforeAll(async () => { - neo4j = new Neo4jHelper(); - driver = await neo4j.getDriver(); - }); + let testHelper: TestHelper; - afterAll(async () => { - await driver.close(); - }); - - beforeEach(async () => { - session = await neo4j.getSession(); + beforeEach(() => { + testHelper = new TestHelper(); }); afterEach(async () => { - await session.close(); + await testHelper.close(); }); test("should push to and pop from two different arrays in the same update", async () => { - const typeMovie = new UniqueType("Movie"); + const typeMovie = testHelper.createUniqueType("Movie"); const typeDefs = gql` type ${typeMovie} { @@ -59,7 +43,7 @@ describe("array-pop-and-push", () => { } `; - const neoSchema = new Neo4jGraphQL({ typeDefs }); + await testHelper.initNeo4jGraphQL({ typeDefs }); const movieTitle = generate({ charset: "alphabetic", @@ -81,13 +65,9 @@ describe("array-pop-and-push", () => { CREATE (m:${typeMovie} {title:$movieTitle, tags: ["abc"], moreTags: ["this", "that", "them"] }) `; - await session.run(cypher, { movieTitle }); + await testHelper.runCypher(cypher, { movieTitle }); - const gqlResult = await graphql({ - schema: await neoSchema.getSchema(), - source: update, - contextValue: neo4j.getContextValues(), - }); + const gqlResult = await testHelper.runGraphQL(update); if (gqlResult.errors) { console.log(JSON.stringify(gqlResult.errors, null, 2)); diff --git a/packages/graphql/tests/integration/array-methods/array-pop-errors.int.test.ts b/packages/graphql/tests/integration/array-methods/array-pop-errors.int.test.ts index c735a1eaf4..0ea93178b3 100644 --- a/packages/graphql/tests/integration/array-methods/array-pop-errors.int.test.ts +++ b/packages/graphql/tests/integration/array-methods/array-pop-errors.int.test.ts @@ -18,40 +18,25 @@ */ import type { GraphQLError } from "graphql"; -import { graphql } from "graphql"; import { gql } from "graphql-tag"; import { IncomingMessage } from "http"; -import type { Driver, Session } from "neo4j-driver"; import { Socket } from "net"; import { generate } from "randomstring"; - -import { Neo4jGraphQL } from "../../../src/classes"; -import { UniqueType } from "../../utils/graphql-types"; -import Neo4jHelper from "../neo4j"; +import { TestHelper } from "../utils/tests-helper"; describe("array-pop-errors", () => { - let driver: Driver; - let session: Session; - let neo4j: Neo4jHelper; - - beforeAll(async () => { - neo4j = new Neo4jHelper(); - driver = await neo4j.getDriver(); - }); + let testHelper: TestHelper; - afterAll(async () => { - await driver.close(); - }); - - beforeEach(async () => { - session = await neo4j.getSession(); + beforeEach(() => { + testHelper = new TestHelper(); }); afterEach(async () => { - await session.close(); + await testHelper.close(); }); + test("should throw an error when trying to pop an element from a non-existing array", async () => { - const typeMovie = new UniqueType("Movie"); + const typeMovie = testHelper.createUniqueType("Movie"); const typeDefs = gql` type ${typeMovie} { @@ -60,7 +45,7 @@ describe("array-pop-errors", () => { } `; - const neoSchema = new Neo4jGraphQL({ typeDefs }); + await testHelper.initNeo4jGraphQL({ typeDefs }); const movieTitle = generate({ charset: "alphabetic", @@ -82,13 +67,9 @@ describe("array-pop-errors", () => { CREATE (m:${typeMovie} {title:$movieTitle}) `; - await session.run(cypher, { movieTitle }); + await testHelper.runCypher(cypher, { movieTitle }); - const gqlResult = await graphql({ - schema: await neoSchema.getSchema(), - source: update, - contextValue: neo4j.getContextValues(), - }); + const gqlResult = await testHelper.runGraphQL(update); expect(gqlResult.errors).toBeDefined(); expect( @@ -99,7 +80,7 @@ describe("array-pop-errors", () => { }); test("should throw an error when trying to pop an element from multiple non-existing arrays", async () => { - const typeMovie = new UniqueType("Movie"); + const typeMovie = testHelper.createUniqueType("Movie"); const typeDefs = gql` type ${typeMovie} { @@ -109,7 +90,7 @@ describe("array-pop-errors", () => { } `; - const neoSchema = new Neo4jGraphQL({ typeDefs }); + await testHelper.initNeo4jGraphQL({ typeDefs }); const movieTitle = generate({ charset: "alphabetic", @@ -132,13 +113,9 @@ describe("array-pop-errors", () => { CREATE (m:${typeMovie} {title:$movieTitle}) `; - await session.run(cypher, { movieTitle }); + await testHelper.runCypher(cypher, { movieTitle }); - const gqlResult = await graphql({ - schema: await neoSchema.getSchema(), - source: update, - contextValue: neo4j.getContextValues(), - }); + const gqlResult = await testHelper.runGraphQL(update); expect(gqlResult.errors).toBeDefined(); expect( @@ -151,7 +128,7 @@ describe("array-pop-errors", () => { }); test("should throw an error if not authenticated on field definition", async () => { - const typeMovie = new UniqueType("Movie"); + const typeMovie = testHelper.createUniqueType("Movie"); const typeDefs = ` type ${typeMovie} { title: String @@ -159,7 +136,10 @@ describe("array-pop-errors", () => { } `; - const neoSchema = new Neo4jGraphQL({ typeDefs, features: { authorization: { key: "secret" } } }); + await testHelper.initNeo4jGraphQL({ + typeDefs, + features: { authorization: { key: "secret" } }, + }); const movieTitle = generate({ charset: "alphabetic", @@ -180,7 +160,7 @@ describe("array-pop-errors", () => { CREATE (m:${typeMovie} {title:$movieTitle, tags: ['a', 'b']}) `; - await session.run(cypher, { movieTitle }); + await testHelper.runCypher(cypher, { movieTitle }); const token = "not valid token"; @@ -188,11 +168,7 @@ describe("array-pop-errors", () => { const req = new IncomingMessage(socket); req.headers.authorization = `Bearer ${token}`; - const gqlResult = await graphql({ - schema: await neoSchema.getSchema(), - source: update, - contextValue: neo4j.getContextValues(), - }); + const gqlResult = await testHelper.runGraphQL(update); expect(gqlResult.errors).toBeDefined(); expect((gqlResult.errors as GraphQLError[]).some((el) => el.message.includes("Unauthenticated"))).toBeTruthy(); @@ -200,7 +176,7 @@ describe("array-pop-errors", () => { }); test("should throw an error when input is invalid", async () => { - const typeMovie = new UniqueType("Movie"); + const typeMovie = testHelper.createUniqueType("Movie"); const typeDefs = gql` type ${typeMovie} { @@ -209,7 +185,7 @@ describe("array-pop-errors", () => { } `; - const neoSchema = new Neo4jGraphQL({ typeDefs }); + await testHelper.initNeo4jGraphQL({ typeDefs }); const movieTitle = generate({ charset: "alphabetic", @@ -230,13 +206,9 @@ describe("array-pop-errors", () => { CREATE (m:${typeMovie} {title:$movieTitle, tags: ["abc", "xyz"]}) `; - await session.run(cypher, { movieTitle }); + await testHelper.runCypher(cypher, { movieTitle }); - const gqlResult = await graphql({ - schema: await neoSchema.getSchema(), - source: update, - contextValue: neo4j.getContextValues(), - }); + const gqlResult = await testHelper.runGraphQL(update); expect(gqlResult.errors).toBeDefined(); expect( @@ -249,7 +221,7 @@ describe("array-pop-errors", () => { }); test("should throw an error when performing an ambiguous property update", async () => { - const typeMovie = new UniqueType("Movie"); + const typeMovie = testHelper.createUniqueType("Movie"); const typeDefs = gql` type ${typeMovie} { @@ -258,7 +230,7 @@ describe("array-pop-errors", () => { } `; - const neoSchema = new Neo4jGraphQL({ typeDefs }); + await testHelper.initNeo4jGraphQL({ typeDefs }); const movieTitle = generate({ charset: "alphabetic", @@ -279,13 +251,9 @@ describe("array-pop-errors", () => { CREATE (m:${typeMovie} {title:$movieTitle, tags:["existing value"]}) `; - await session.run(cypher, { movieTitle }); + await testHelper.runCypher(cypher, { movieTitle }); - const gqlResult = await graphql({ - schema: await neoSchema.getSchema(), - source: update, - contextValue: neo4j.getContextValues(), - }); + const gqlResult = await testHelper.runGraphQL(update); expect(gqlResult.errors).toBeDefined(); expect( @@ -298,8 +266,8 @@ describe("array-pop-errors", () => { test("should throw an error when performing an ambiguous property update on relationship properties", async () => { const initialPay = 100; - const movie = new UniqueType("Movie"); - const actor = new UniqueType("Actor"); + const movie = testHelper.createUniqueType("Movie"); + const actor = testHelper.createUniqueType("Actor"); const typeDefs = ` type ${movie.name} { title: String @@ -317,7 +285,7 @@ describe("array-pop-errors", () => { } `; - const neoSchema = new Neo4jGraphQL({ typeDefs }); + await testHelper.initNeo4jGraphQL({ typeDefs }); const id = generate({ charset: "alphabetic", @@ -355,7 +323,7 @@ describe("array-pop-errors", () => { `; // Create new movie - await session.run( + await testHelper.runCypher( ` CREATE (a:${movie.name} {title: "The Matrix"}), (b:${actor.name} {id: $id, name: "Keanu"}) WITH a,b CREATE (a)<-[actedIn: ACTED_IN{ pay: $initialPay }]-(b) RETURN a, actedIn, b `, @@ -365,11 +333,8 @@ describe("array-pop-errors", () => { } ); // Update movie - const gqlResult = await graphql({ - schema: await neoSchema.getSchema(), - source: query, + const gqlResult = await testHelper.runGraphQL(query, { variableValues: { id, numberToPop: 1 }, - contextValue: neo4j.getContextValues(), }); expect(gqlResult.errors).toBeDefined(); diff --git a/packages/graphql/tests/integration/array-methods/array-pop.int.test.ts b/packages/graphql/tests/integration/array-methods/array-pop.int.test.ts index c989370f7f..f88d85df71 100644 --- a/packages/graphql/tests/integration/array-methods/array-pop.int.test.ts +++ b/packages/graphql/tests/integration/array-methods/array-pop.int.test.ts @@ -18,35 +18,19 @@ */ import { faker } from "@faker-js/faker"; -import { graphql } from "graphql"; import { gql } from "graphql-tag"; -import type { Driver, Session } from "neo4j-driver"; import { generate } from "randomstring"; - -import { Neo4jGraphQL } from "../../../src/classes"; -import { UniqueType } from "../../utils/graphql-types"; -import Neo4jHelper from "../neo4j"; +import { TestHelper } from "../utils/tests-helper"; describe("array-pop", () => { - let driver: Driver; - let session: Session; - let neo4j: Neo4jHelper; - - beforeAll(async () => { - neo4j = new Neo4jHelper(); - driver = await neo4j.getDriver(); - }); - - afterAll(async () => { - await driver.close(); - }); + let testHelper: TestHelper; - beforeEach(async () => { - session = await neo4j.getSession(); + beforeEach(() => { + testHelper = new TestHelper(); }); afterEach(async () => { - await session.close(); + await testHelper.close(); }); const dateTime = new Date().toISOString(); @@ -110,7 +94,7 @@ describe("array-pop", () => { ] as const)( "should pop a single $inputType element from an array of a single $inputType element", async ({ inputType, initialValue, expectedOutputValue }) => { - const typeMovie = new UniqueType("Movie"); + const typeMovie = testHelper.createUniqueType("Movie"); const typeDefs = gql` type ${typeMovie} { @@ -119,7 +103,7 @@ describe("array-pop", () => { } `; - const neoSchema = new Neo4jGraphQL({ typeDefs }); + await testHelper.initNeo4jGraphQL({ typeDefs }); const movieTitle = generate({ charset: "alphabetic", @@ -140,13 +124,9 @@ describe("array-pop", () => { CREATE (m:${typeMovie} {title:$movieTitle, tags: ${initialValue}}) `; - await session.run(cypher, { movieTitle }); + await testHelper.runCypher(cypher, { movieTitle }); - const gqlResult = await graphql({ - schema: await neoSchema.getSchema(), - source: update, - contextValue: neo4j.getContextValues(), - }); + const gqlResult = await testHelper.runGraphQL(update); if (gqlResult.errors) { console.log(JSON.stringify(gqlResult.errors, null, 2)); @@ -214,7 +194,7 @@ describe("array-pop", () => { ] as const)( "should pop a single $inputType element from an array of two $inputType elements", async ({ inputType, initialValue, expectedOutputValue }) => { - const typeMovie = new UniqueType("Movie"); + const typeMovie = testHelper.createUniqueType("Movie"); const typeDefs = gql` type ${typeMovie} { @@ -223,7 +203,7 @@ describe("array-pop", () => { } `; - const neoSchema = new Neo4jGraphQL({ typeDefs }); + await testHelper.initNeo4jGraphQL({ typeDefs }); const movieTitle = generate({ charset: "alphabetic", @@ -244,13 +224,9 @@ describe("array-pop", () => { CREATE (m:${typeMovie} {title:$movieTitle, tags: ${initialValue}}) `; - await session.run(cypher, { movieTitle }); + await testHelper.runCypher(cypher, { movieTitle }); - const gqlResult = await graphql({ - schema: await neoSchema.getSchema(), - source: update, - contextValue: neo4j.getContextValues(), - }); + const gqlResult = await testHelper.runGraphQL(update); if (gqlResult.errors) { console.log(JSON.stringify(gqlResult.errors, null, 2)); @@ -318,7 +294,7 @@ describe("array-pop", () => { ] as const)( "should pop two $inputType elements from an array of two $inputType elements", async ({ inputType, initialValue, expectedOutputValue }) => { - const typeMovie = new UniqueType("Movie"); + const typeMovie = testHelper.createUniqueType("Movie"); const typeDefs = gql` type ${typeMovie} { @@ -327,7 +303,7 @@ describe("array-pop", () => { } `; - const neoSchema = new Neo4jGraphQL({ typeDefs }); + await testHelper.initNeo4jGraphQL({ typeDefs }); const movieTitle = generate({ charset: "alphabetic", @@ -348,13 +324,9 @@ describe("array-pop", () => { CREATE (m:${typeMovie} {title:$movieTitle, tags: ${initialValue}}) `; - await session.run(cypher, { movieTitle }); + await testHelper.runCypher(cypher, { movieTitle }); - const gqlResult = await graphql({ - schema: await neoSchema.getSchema(), - source: update, - contextValue: neo4j.getContextValues(), - }); + const gqlResult = await testHelper.runGraphQL(update); if (gqlResult.errors) { console.log(JSON.stringify(gqlResult.errors, null, 2)); @@ -402,7 +374,7 @@ describe("array-pop", () => { elementsToPop: 2, }, ])("should pop $description", async ({ elementsToPop, tags, expectedOutputValue }) => { - const typeMovie = new UniqueType("Movie"); + const typeMovie = testHelper.createUniqueType("Movie"); const typeDefs = gql` type ${typeMovie} { @@ -411,7 +383,7 @@ describe("array-pop", () => { } `; - const neoSchema = new Neo4jGraphQL({ typeDefs }); + await testHelper.initNeo4jGraphQL({ typeDefs }); const movieTitle = generate({ charset: "alphabetic", @@ -435,10 +407,7 @@ describe("array-pop", () => { } `; - const gqlCreateResult = await graphql({ - schema: await neoSchema.getSchema(), - source: create, - contextValue: neo4j.getContextValues(), + const gqlCreateResult = await testHelper.runGraphQL(create, { variableValues: { title: movieTitle, longitude: point.longitude, @@ -468,10 +437,7 @@ describe("array-pop", () => { } `; - const gqlUpdateResult = await graphql({ - schema: await neoSchema.getSchema(), - source: update, - contextValue: neo4j.getContextValues(), + const gqlUpdateResult = await testHelper.runGraphQL(update, { variableValues: { elementsToPop }, }); @@ -519,7 +485,7 @@ describe("array-pop", () => { elementsToPop: 2, }, ])("should pop $description", async ({ elementsToPop, tags, expectedOutputValue }) => { - const typeMovie = new UniqueType("Movie"); + const typeMovie = testHelper.createUniqueType("Movie"); const typeDefs = gql` type ${typeMovie} { @@ -528,7 +494,7 @@ describe("array-pop", () => { } `; - const neoSchema = new Neo4jGraphQL({ typeDefs }); + await testHelper.initNeo4jGraphQL({ typeDefs }); const movieTitle = generate({ charset: "alphabetic", @@ -551,10 +517,7 @@ describe("array-pop", () => { } `; - const gqlCreateResult = await graphql({ - schema: await neoSchema.getSchema(), - source: create, - contextValue: neo4j.getContextValues(), + const gqlCreateResult = await testHelper.runGraphQL(create, { variableValues: { title: movieTitle, x: cartesianPoint.x, @@ -582,10 +545,7 @@ describe("array-pop", () => { } `; - const gqlUpdateResult = await graphql({ - schema: await neoSchema.getSchema(), - source: update, - contextValue: neo4j.getContextValues(), + const gqlUpdateResult = await testHelper.runGraphQL(update, { variableValues: { elementsToPop }, }); @@ -601,7 +561,7 @@ describe("array-pop", () => { }); test("should pop from two different arrays in the same update", async () => { - const typeMovie = new UniqueType("Movie"); + const typeMovie = testHelper.createUniqueType("Movie"); const typeDefs = gql` type ${typeMovie} { @@ -611,7 +571,7 @@ describe("array-pop", () => { } `; - const neoSchema = new Neo4jGraphQL({ typeDefs }); + await testHelper.initNeo4jGraphQL({ typeDefs }); const movieTitle = generate({ charset: "alphabetic", @@ -633,13 +593,9 @@ describe("array-pop", () => { CREATE (m:${typeMovie} {title:$movieTitle, tags: ["abc", "xyz"], moreTags: ["this", "that", "them"] }) `; - await session.run(cypher, { movieTitle }); + await testHelper.runCypher(cypher, { movieTitle }); - const gqlResult = await graphql({ - schema: await neoSchema.getSchema(), - source: update, - contextValue: neo4j.getContextValues(), - }); + const gqlResult = await testHelper.runGraphQL(update); if (gqlResult.errors) { console.log(JSON.stringify(gqlResult.errors, null, 2)); @@ -654,8 +610,8 @@ describe("array-pop", () => { test("should be able to pop in a nested update", async () => { const actorName = "Luigino"; - const movie = new UniqueType("Movie"); - const actor = new UniqueType("Actor"); + const movie = testHelper.createUniqueType("Movie"); + const actor = testHelper.createUniqueType("Actor"); const typeDefs = ` type ${movie.name} { viewers: [Int]! @@ -668,7 +624,7 @@ describe("array-pop", () => { } `; - const neoSchema = new Neo4jGraphQL({ typeDefs }); + await testHelper.initNeo4jGraphQL({ typeDefs }); const id = generate({ charset: "alphabetic", @@ -704,16 +660,13 @@ describe("array-pop", () => { WITH a,b CREATE (a)<-[worksInMovies: WORKED_IN]-(b) `; - await session.run(cypher, { + await testHelper.runCypher(cypher, { id, initialViewers: [1, 2], name: actorName, }); - const gqlResult = await graphql({ - schema: await neoSchema.getSchema(), - source: update, - contextValue: neo4j.getContextValues(), + const gqlResult = await testHelper.runGraphQL(update, { variableValues: { numberToPop: 1, id }, }); @@ -725,8 +678,8 @@ describe("array-pop", () => { test("should be possible to update relationship properties", async () => { const initialPay = 100; - const movie = new UniqueType("Movie"); - const actor = new UniqueType("Actor"); + const movie = testHelper.createUniqueType("Movie"); + const actor = testHelper.createUniqueType("Actor"); const typeDefs = ` type ${movie.name} { title: String @@ -744,7 +697,7 @@ describe("array-pop", () => { } `; - const neoSchema = new Neo4jGraphQL({ typeDefs }); + await testHelper.initNeo4jGraphQL({ typeDefs }); const id = generate({ charset: "alphabetic", @@ -781,7 +734,7 @@ describe("array-pop", () => { `; // Create new movie - await session.run( + await testHelper.runCypher( ` CREATE (a:${movie.name} {title: "The Matrix"}), (b:${actor.name} {id: $id, name: "Keanu"}) WITH a,b CREATE (a)<-[actedIn: ACTED_IN{ pay: $initialPay }]-(b) RETURN a, actedIn, b `, @@ -791,15 +744,12 @@ describe("array-pop", () => { } ); // Update movie - const gqlResult = await graphql({ - schema: await neoSchema.getSchema(), - source: query, + const gqlResult = await testHelper.runGraphQL(query, { variableValues: { id, numberToPop: 1 }, - contextValue: neo4j.getContextValues(), }); expect(gqlResult.errors).toBeUndefined(); - const storedValue = await session.run( + const storedValue = await testHelper.runCypher( ` MATCH(b: ${actor.name}{id: $id}) -[c: ACTED_IN]-> (a: ${movie.name}) RETURN c.pay as pay `, @@ -811,8 +761,8 @@ describe("array-pop", () => { }); test("should be possible to update Point relationship properties", async () => { - const movie = new UniqueType("Movie"); - const actor = new UniqueType("Actor"); + const movie = testHelper.createUniqueType("Movie"); + const actor = testHelper.createUniqueType("Actor"); const typeDefs = ` type ${movie.name} { title: String @@ -830,7 +780,7 @@ describe("array-pop", () => { } `; - const neoSchema = new Neo4jGraphQL({ typeDefs }); + await testHelper.initNeo4jGraphQL({ typeDefs }); const id = generate({ charset: "alphabetic", @@ -871,7 +821,7 @@ describe("array-pop", () => { `; // Create new movie - await session.run( + await testHelper.runCypher( ` CREATE (a:${movie.name} {title: "The Matrix"}), (b:${actor.name} {id: $id, name: "Keanu"}) WITH a,b CREATE (a)<-[actedIn: ACTED_IN{ locations: [point($initialLocation)] }]-(b) RETURN a, actedIn, b `, @@ -881,11 +831,8 @@ describe("array-pop", () => { } ); // Update movie - const gqlResult = await graphql({ - schema: await neoSchema.getSchema(), - source: query, + const gqlResult = await testHelper.runGraphQL(query, { variableValues: { id, numberToPop: 1 }, - contextValue: neo4j.getContextValues(), }); expect(gqlResult.errors).toBeUndefined(); diff --git a/packages/graphql/tests/integration/array-methods/array-push-errors.int.test.ts b/packages/graphql/tests/integration/array-methods/array-push-errors.int.test.ts index d95b11978d..d8770df6d6 100644 --- a/packages/graphql/tests/integration/array-methods/array-push-errors.int.test.ts +++ b/packages/graphql/tests/integration/array-methods/array-push-errors.int.test.ts @@ -18,40 +18,25 @@ */ import type { GraphQLError } from "graphql"; -import { graphql } from "graphql"; import { gql } from "graphql-tag"; import { IncomingMessage } from "http"; -import type { Driver, Session } from "neo4j-driver"; import { Socket } from "net"; import { generate } from "randomstring"; - -import { Neo4jGraphQL } from "../../../src/classes"; -import { UniqueType } from "../../utils/graphql-types"; -import Neo4jHelper from "../neo4j"; +import { TestHelper } from "../utils/tests-helper"; describe("array-push", () => { - let driver: Driver; - let session: Session; - let neo4j: Neo4jHelper; - beforeAll(async () => { - neo4j = new Neo4jHelper(); - driver = await neo4j.getDriver(); - }); + let testHelper: TestHelper; - afterAll(async () => { - await driver.close(); - }); - - beforeEach(async () => { - session = await neo4j.getSession(); + beforeEach(() => { + testHelper = new TestHelper(); }); afterEach(async () => { - await session.close(); + await testHelper.close(); }); test("should throw an error when trying to push on to a non-existing array", async () => { - const typeMovie = new UniqueType("Movie"); + const typeMovie = testHelper.createUniqueType("Movie"); const typeDefs = gql` type ${typeMovie} { @@ -60,7 +45,7 @@ describe("array-push", () => { } `; - const neoSchema = new Neo4jGraphQL({ typeDefs }); + await testHelper.initNeo4jGraphQL({ typeDefs }); const movieTitle = generate({ charset: "alphabetic", @@ -82,13 +67,9 @@ describe("array-push", () => { CREATE (m:${typeMovie} {title:$movieTitle}) `; - await session.run(cypher, { movieTitle }); + await testHelper.runCypher(cypher, { movieTitle }); - const gqlResult = await graphql({ - schema: await neoSchema.getSchema(), - source: update, - contextValue: neo4j.getContextValues(), - }); + const gqlResult = await testHelper.runGraphQL(update); expect(gqlResult.errors).toBeDefined(); expect( @@ -99,7 +80,7 @@ describe("array-push", () => { }); test("should throw an error if not authenticated on field definition", async () => { - const typeMovie = new UniqueType("Movie"); + const typeMovie = testHelper.createUniqueType("Movie"); const typeDefs = ` type ${typeMovie} { title: String @@ -107,7 +88,10 @@ describe("array-push", () => { } `; - const neoSchema = new Neo4jGraphQL({ typeDefs, features: { authorization: { key: "secret" } } }); + await testHelper.initNeo4jGraphQL({ + typeDefs, + features: { authorization: { key: "secret" } }, + }); const update = ` mutation { @@ -128,7 +112,7 @@ describe("array-push", () => { CREATE (m:${typeMovie} {title:$movieTitle, tags: []}) `; - await session.run(cypher, { movieTitle }); + await testHelper.runCypher(cypher, { movieTitle }); const token = "not valid token"; @@ -136,10 +120,8 @@ describe("array-push", () => { const req = new IncomingMessage(socket); req.headers.authorization = `Bearer ${token}`; - const gqlResult = await graphql({ - schema: await neoSchema.getSchema(), - source: update, - contextValue: neo4j.getContextValues({ req }), + const gqlResult = await testHelper.runGraphQL(update, { + contextValue: { req }, }); expect(gqlResult.errors).toBeDefined(); @@ -148,7 +130,7 @@ describe("array-push", () => { }); test("should throw an error when input is invalid", async () => { - const typeMovie = new UniqueType("Movie"); + const typeMovie = testHelper.createUniqueType("Movie"); const typeDefs = gql` type ${typeMovie} { @@ -157,7 +139,7 @@ describe("array-push", () => { } `; - const neoSchema = new Neo4jGraphQL({ typeDefs }); + await testHelper.initNeo4jGraphQL({ typeDefs }); const movieTitle = generate({ charset: "alphabetic", @@ -178,13 +160,9 @@ describe("array-push", () => { CREATE (m:${typeMovie} {title:$movieTitle, tags:[]}) `; - await session.run(cypher, { movieTitle }); + await testHelper.runCypher(cypher, { movieTitle }); - const gqlResult = await graphql({ - schema: await neoSchema.getSchema(), - source: update, - contextValue: neo4j.getContextValues(), - }); + const gqlResult = await testHelper.runGraphQL(update); expect(gqlResult.errors).toBeDefined(); expect( @@ -196,7 +174,7 @@ describe("array-push", () => { }); test("should throw an error when performing an ambiguous property update", async () => { - const typeMovie = new UniqueType("Movie"); + const typeMovie = testHelper.createUniqueType("Movie"); const typeDefs = gql` type ${typeMovie} { @@ -205,7 +183,7 @@ describe("array-push", () => { } `; - const neoSchema = new Neo4jGraphQL({ typeDefs }); + await testHelper.initNeo4jGraphQL({ typeDefs }); const movieTitle = generate({ charset: "alphabetic", @@ -226,17 +204,9 @@ describe("array-push", () => { CREATE (m:${typeMovie} {title:$movieTitle, tags:["existing value"]}) `; - await session.run(cypher, { movieTitle }); + await testHelper.runCypher(cypher, { movieTitle }); - const gqlResult = await graphql({ - schema: await neoSchema.getSchema(), - source: update, - contextValue: neo4j.getContextValues(), - }); - - if (gqlResult.errors) { - console.log(JSON.stringify(gqlResult.errors, null, 2)); - } + const gqlResult = await testHelper.runGraphQL(update); expect(gqlResult.errors).toBeDefined(); expect( @@ -250,8 +220,8 @@ describe("array-push", () => { test("should throw an error when performing an ambiguous property update on relationship properties", async () => { const initialPay = 100; const payIncrement = 50; - const movie = new UniqueType("Movie"); - const actor = new UniqueType("Actor"); + const movie = testHelper.createUniqueType("Movie"); + const actor = testHelper.createUniqueType("Actor"); const typeDefs = ` type ${movie.name} { title: String @@ -269,7 +239,7 @@ describe("array-push", () => { } `; - const neoSchema = new Neo4jGraphQL({ typeDefs }); + await testHelper.initNeo4jGraphQL({ typeDefs }); const id = generate({ charset: "alphabetic", @@ -307,7 +277,7 @@ describe("array-push", () => { `; // Create new movie - await session.run( + await testHelper.runCypher( ` CREATE (a:${movie.name} {title: "The Matrix"}), (b:${actor.name} {id: $id, name: "Keanu"}) WITH a,b CREATE (a)<-[actedIn: ACTED_IN{ pay: $initialPay }]-(b) RETURN a, actedIn, b `, @@ -317,17 +287,10 @@ describe("array-push", () => { } ); // Update movie - const gqlResult = await graphql({ - schema: await neoSchema.getSchema(), - source: query, + const gqlResult = await testHelper.runGraphQL(query, { variableValues: { id, payIncrement }, - contextValue: neo4j.getContextValues(), }); - if (gqlResult.errors) { - console.log(JSON.stringify(gqlResult.errors, null, 2)); - } - expect(gqlResult.errors).toBeDefined(); expect( (gqlResult.errors as GraphQLError[]).some((el) => diff --git a/packages/graphql/tests/integration/array-methods/array-push.int.test.ts b/packages/graphql/tests/integration/array-methods/array-push.int.test.ts index 88c9111a47..5fa501c9cf 100644 --- a/packages/graphql/tests/integration/array-methods/array-push.int.test.ts +++ b/packages/graphql/tests/integration/array-methods/array-push.int.test.ts @@ -18,35 +18,19 @@ */ import { faker } from "@faker-js/faker"; -import { graphql } from "graphql"; import { gql } from "graphql-tag"; -import type { Driver, Session } from "neo4j-driver"; import { generate } from "randomstring"; - -import { Neo4jGraphQL } from "../../../src/classes"; -import { UniqueType } from "../../utils/graphql-types"; -import Neo4jHelper from "../neo4j"; +import { TestHelper } from "../utils/tests-helper"; describe("array-push", () => { - let driver: Driver; - let session: Session; - let neo4j: Neo4jHelper; - - beforeAll(async () => { - neo4j = new Neo4jHelper(); - driver = await neo4j.getDriver(); - }); + let testHelper: TestHelper; - afterAll(async () => { - await driver.close(); - }); - - beforeEach(async () => { - session = await neo4j.getSession(); + beforeEach(() => { + testHelper = new TestHelper(); }); afterEach(async () => { - await session.close(); + await testHelper.close(); }); const date = new Date().toISOString(); @@ -238,7 +222,7 @@ describe("array-push", () => { ] as const)( "should push $description on to an existing array", async ({ inputType, inputValue, expectedOutputValue }) => { - const typeMovie = new UniqueType("Movie"); + const typeMovie = testHelper.createUniqueType("Movie"); const typeDefs = gql` type ${typeMovie} { @@ -247,7 +231,7 @@ describe("array-push", () => { } `; - const neoSchema = new Neo4jGraphQL({ typeDefs }); + await testHelper.initNeo4jGraphQL({ typeDefs }); const movieTitle = generate({ charset: "alphabetic", @@ -268,13 +252,9 @@ describe("array-push", () => { CREATE (m:${typeMovie} {title:$movieTitle, tags: []}) `; - await session.run(cypher, { movieTitle }); + await testHelper.runCypher(cypher, { movieTitle }); - const gqlResult = await graphql({ - schema: await neoSchema.getSchema(), - source: update, - contextValue: neo4j.getContextValues(), - }); + const gqlResult = await testHelper.runGraphQL(update); if (gqlResult.errors) { console.log(JSON.stringify(gqlResult.errors, null, 2)); @@ -316,7 +296,7 @@ describe("array-push", () => { ] as const)( "should push $description on to an existing array", async ({ inputType, inputValue, expectedOutputValue }) => { - const typeMovie = new UniqueType("Movie"); + const typeMovie = testHelper.createUniqueType("Movie"); const typeDefs = gql` type ${typeMovie} { @@ -325,7 +305,7 @@ describe("array-push", () => { } `; - const neoSchema = new Neo4jGraphQL({ typeDefs }); + await testHelper.initNeo4jGraphQL({ typeDefs }); const movieTitle = generate({ charset: "alphabetic", @@ -350,12 +330,9 @@ describe("array-push", () => { CREATE (m:${typeMovie} {title:$movieTitle, tags: []}) `; - await session.run(cypher, { movieTitle }); + await testHelper.runCypher(cypher, { movieTitle }); - const gqlResult = await graphql({ - schema: await neoSchema.getSchema(), - source: update, - contextValue: neo4j.getContextValues(), + const gqlResult = await testHelper.runGraphQL(update, { variableValues: { inputValue }, }); @@ -398,7 +375,7 @@ describe("array-push", () => { ] as const)( "should push $description on to an existing array", async ({ inputType, inputValue, expectedOutputValue }) => { - const typeMovie = new UniqueType("Movie"); + const typeMovie = testHelper.createUniqueType("Movie"); const typeDefs = gql` type ${typeMovie} { @@ -407,7 +384,7 @@ describe("array-push", () => { } `; - const neoSchema = new Neo4jGraphQL({ typeDefs }); + await testHelper.initNeo4jGraphQL({ typeDefs }); const movieTitle = generate({ charset: "alphabetic", @@ -431,12 +408,9 @@ describe("array-push", () => { CREATE (m:${typeMovie} {title:$movieTitle, tags: []}) `; - await session.run(cypher, { movieTitle }); + await testHelper.runCypher(cypher, { movieTitle }); - const gqlResult = await graphql({ - schema: await neoSchema.getSchema(), - source: update, - contextValue: neo4j.getContextValues(), + const gqlResult = await testHelper.runGraphQL(update, { variableValues: { inputValue }, }); @@ -453,7 +427,7 @@ describe("array-push", () => { ); test("should push to two different arrays in the same update", async () => { - const typeMovie = new UniqueType("Movie"); + const typeMovie = testHelper.createUniqueType("Movie"); const typeDefs = gql` type ${typeMovie} { @@ -463,7 +437,7 @@ describe("array-push", () => { } `; - const neoSchema = new Neo4jGraphQL({ typeDefs }); + await testHelper.initNeo4jGraphQL({ typeDefs }); const movieTitle = generate({ charset: "alphabetic", @@ -485,13 +459,9 @@ describe("array-push", () => { CREATE (m:${typeMovie} {title:$movieTitle, tags: [], moreTags: [] }) `; - await session.run(cypher, { movieTitle }); + await testHelper.runCypher(cypher, { movieTitle }); - const gqlResult = await graphql({ - schema: await neoSchema.getSchema(), - source: update, - contextValue: neo4j.getContextValues(), - }); + const gqlResult = await testHelper.runGraphQL(update); if (gqlResult.errors) { console.log(JSON.stringify(gqlResult.errors, null, 2)); @@ -506,8 +476,8 @@ describe("array-push", () => { test("should be able to push in a nested update", async () => { const actorName = "Luigino"; - const movie = new UniqueType("Movie"); - const actor = new UniqueType("Actor"); + const movie = testHelper.createUniqueType("Movie"); + const actor = testHelper.createUniqueType("Actor"); const typeDefs = ` type ${movie.name} { viewers: [Int]! @@ -520,7 +490,7 @@ describe("array-push", () => { } `; - const neoSchema = new Neo4jGraphQL({ typeDefs }); + await testHelper.initNeo4jGraphQL({ typeDefs }); const id = generate({ charset: "alphabetic", @@ -556,16 +526,13 @@ describe("array-push", () => { WITH a,b CREATE (a)<-[worksInMovies: WORKED_IN]-(b) `; - await session.run(cypher, { + await testHelper.runCypher(cypher, { id, initialViewers: [], name: actorName, }); - const gqlResult = await graphql({ - schema: await neoSchema.getSchema(), - source: update, - contextValue: neo4j.getContextValues(), + const gqlResult = await testHelper.runGraphQL(update, { variableValues: { value: [1, 2, 3, 4], id }, }); @@ -578,8 +545,8 @@ describe("array-push", () => { test("should be possible to update relationship properties", async () => { const initialPay = 100; const payIncrement = 50; - const movie = new UniqueType("Movie"); - const actor = new UniqueType("Actor"); + const movie = testHelper.createUniqueType("Movie"); + const actor = testHelper.createUniqueType("Actor"); const typeDefs = ` type ${movie.name} { title: String @@ -597,7 +564,7 @@ describe("array-push", () => { } `; - const neoSchema = new Neo4jGraphQL({ typeDefs }); + await testHelper.initNeo4jGraphQL({ typeDefs }); const id = generate({ charset: "alphabetic", @@ -634,7 +601,7 @@ describe("array-push", () => { `; // Create new movie - await session.run( + await testHelper.runCypher( ` CREATE (a:${movie.name} {title: "The Matrix"}), (b:${actor.name} {id: $id, name: "Keanu"}) WITH a,b CREATE (a)<-[actedIn: ACTED_IN{ pay: $initialPay }]-(b) RETURN a, actedIn, b `, @@ -644,15 +611,12 @@ describe("array-push", () => { } ); // Update movie - const gqlResult = await graphql({ - schema: await neoSchema.getSchema(), - source: query, + const gqlResult = await testHelper.runGraphQL(query, { variableValues: { id, payIncrement }, - contextValue: neo4j.getContextValues(), }); expect(gqlResult.errors).toBeUndefined(); - const storedValue = await session.run( + const storedValue = await testHelper.runCypher( ` MATCH(b: ${actor.name}{id: $id}) -[c: ACTED_IN]-> (a: ${movie.name}) RETURN c.pay as pay `, @@ -664,8 +628,8 @@ describe("array-push", () => { }); test("should be possible to update Point relationship properties", async () => { - const movie = new UniqueType("Movie"); - const actor = new UniqueType("Actor"); + const movie = testHelper.createUniqueType("Movie"); + const actor = testHelper.createUniqueType("Actor"); const typeDefs = ` type ${movie.name} { title: String @@ -683,7 +647,7 @@ describe("array-push", () => { } `; - const neoSchema = new Neo4jGraphQL({ typeDefs }); + await testHelper.initNeo4jGraphQL({ typeDefs }); const id = generate({ charset: "alphabetic", @@ -724,7 +688,7 @@ describe("array-push", () => { `; // Create new movie - await session.run( + await testHelper.runCypher( ` CREATE (a:${movie.name} {title: "The Matrix"}), (b:${actor.name} {id: $id, name: "Keanu"}) WITH a,b CREATE (a)<-[actedIn: ACTED_IN{ locations: [] }]-(b) RETURN a, actedIn, b `, @@ -733,11 +697,8 @@ describe("array-push", () => { } ); // Update movie - const gqlResult = await graphql({ - schema: await neoSchema.getSchema(), - source: query, + const gqlResult = await testHelper.runGraphQL(query, { variableValues: { id, location: [point] }, - contextValue: neo4j.getContextValues(), }); expect(gqlResult.errors).toBeUndefined(); diff --git a/packages/graphql/tests/integration/array-methods/array-subscription.int.test.ts b/packages/graphql/tests/integration/array-methods/array-subscription.int.test.ts index eb6f0a2e10..0f93d35f7e 100644 --- a/packages/graphql/tests/integration/array-methods/array-subscription.int.test.ts +++ b/packages/graphql/tests/integration/array-methods/array-subscription.int.test.ts @@ -18,33 +18,22 @@ */ import { gql } from "graphql-tag"; -import { graphql } from "graphql"; -import type { Driver, Session } from "neo4j-driver"; -import { Neo4jGraphQL } from "../../../src"; -import { UniqueType } from "../../utils/graphql-types"; import { TestSubscriptionsEngine } from "../../utils/TestSubscriptionsEngine"; -import Neo4jHelper from "../neo4j"; +import type { UniqueType } from "../../utils/graphql-types"; +import { TestHelper } from "../utils/tests-helper"; describe("array-subscription", () => { - let driver: Driver; - let neo4j: Neo4jHelper; - let session: Session; - let neoSchema: Neo4jGraphQL; + let testHelper: TestHelper; let plugin: TestSubscriptionsEngine; let typeActor: UniqueType; let typeMovie: UniqueType; - beforeAll(async () => { - neo4j = new Neo4jHelper(); - driver = await neo4j.getDriver(); - }); - beforeEach(async () => { - session = await neo4j.getSession(); + testHelper = new TestHelper(); - typeActor = new UniqueType("Actor"); - typeMovie = new UniqueType("Movie"); + typeActor = testHelper.createUniqueType("Actor"); + typeMovie = testHelper.createUniqueType("Movie"); plugin = new TestSubscriptionsEngine(); const typeDefs = gql` @@ -64,7 +53,7 @@ describe("array-subscription", () => { } `; - neoSchema = new Neo4jGraphQL({ + await testHelper.initNeo4jGraphQL({ typeDefs, features: { subscriptions: plugin, @@ -73,11 +62,7 @@ describe("array-subscription", () => { }); afterEach(async () => { - await session.close(); - }); - - afterAll(async () => { - await driver.close(); + await testHelper.close(); }); test("push", async () => { @@ -91,16 +76,12 @@ describe("array-subscription", () => { } `; - await session.run(` + await testHelper.runCypher(` CREATE (:${typeMovie.name} { id: "1", name: "Terminator", tags: [] }) CREATE (:${typeMovie.name} { id: "2", name: "The Many Adventures of Winnie the Pooh" }) `); - const gqlResult: any = await graphql({ - schema: await neoSchema.getSchema(), - source: query, - contextValue: neo4j.getContextValues(), - }); + const gqlResult: any = await testHelper.runGraphQL(query); expect(gqlResult.errors).toBeUndefined(); @@ -129,16 +110,12 @@ describe("array-subscription", () => { } `; - await session.run(` + await testHelper.runCypher(` CREATE (:${typeMovie.name} { id: "1", name: "Terminator", tags: ["a tag"] }) CREATE (:${typeMovie.name} { id: "2", name: "The Many Adventures of Winnie the Pooh" }) `); - const gqlResult: any = await graphql({ - schema: await neoSchema.getSchema(), - source: query, - contextValue: neo4j.getContextValues(), - }); + const gqlResult: any = await testHelper.runGraphQL(query); expect(gqlResult.errors).toBeUndefined(); @@ -167,16 +144,12 @@ describe("array-subscription", () => { } `; - await session.run(` + await testHelper.runCypher(` CREATE (:${typeMovie.name} { id: "1", name: "Terminator", tags: ["a tag"], moreTags: [] }) CREATE (:${typeMovie.name} { id: "2", name: "The Many Adventures of Winnie the Pooh" }) `); - const gqlResult: any = await graphql({ - schema: await neoSchema.getSchema(), - source: query, - contextValue: neo4j.getContextValues(), - }); + const gqlResult: any = await testHelper.runGraphQL(query); expect(gqlResult.errors).toBeUndefined();