17
17
* limitations under the License.
18
18
*/
19
19
20
- import type { Driver } from "neo4j-driver" ;
21
- import Neo4jHelper from "../neo4j" ;
22
- import { Neo4jGraphQL } from "../../../src/classes" ;
23
20
import { GraphQLError } from "graphql" ;
21
+ import { Neo4jGraphQL } from "../../../src/classes" ;
24
22
25
23
describe ( "Startup Validation" , ( ) => {
26
- let driver : Driver ;
27
- let neo4j : Neo4jHelper ;
28
-
29
24
const typePointAlreadyExistsErrors = [
30
25
new GraphQLError (
31
26
'Type "Point" already exists in the schema. It cannot also be defined in this type definition.'
@@ -103,19 +98,9 @@ describe("Startup Validation", () => {
103
98
}
104
99
` ;
105
100
106
- beforeAll ( async ( ) => {
107
- neo4j = new Neo4jHelper ( ) ;
108
- driver = await neo4j . getDriver ( ) ;
109
- } ) ;
110
-
111
- afterAll ( async ( ) => {
112
- await driver . close ( ) ;
113
- } ) ;
114
-
115
101
test ( "should not throw an error for valid type defs when running startup validation" , async ( ) => {
116
102
const neoSchema = new Neo4jGraphQL ( {
117
103
typeDefs : validTypeDefs ,
118
- driver,
119
104
validate : true ,
120
105
} ) ;
121
106
@@ -125,7 +110,6 @@ describe("Startup Validation", () => {
125
110
test ( "should throw an error for invalid type defs by default" , async ( ) => {
126
111
const neoSchema = new Neo4jGraphQL ( {
127
112
typeDefs : invalidTypeDefs ,
128
- driver,
129
113
} ) ;
130
114
131
115
await expect ( neoSchema . getSchema ( ) ) . rejects . toIncludeSameMembers ( typePointAlreadyExistsErrors ) ;
@@ -134,7 +118,6 @@ describe("Startup Validation", () => {
134
118
test ( "should not throw an error for invalid type defs when validate is false" , async ( ) => {
135
119
const neoSchema = new Neo4jGraphQL ( {
136
120
typeDefs : invalidTypeDefs ,
137
- driver,
138
121
validate : false ,
139
122
} ) ;
140
123
@@ -144,7 +127,6 @@ describe("Startup Validation", () => {
144
127
test ( "should throw an error for invalid type defs when validate is true" , async ( ) => {
145
128
const neoSchema = new Neo4jGraphQL ( {
146
129
typeDefs : invalidTypeDefs ,
147
- driver,
148
130
validate : true ,
149
131
} ) ;
150
132
@@ -165,7 +147,6 @@ describe("Startup Validation", () => {
165
147
test ( "should warn for missing custom resolvers" , async ( ) => {
166
148
const neoSchema = new Neo4jGraphQL ( {
167
149
typeDefs : customResolverTypeDefs ,
168
- driver,
169
150
} ) ;
170
151
171
152
await neoSchema . getSchema ( ) ;
@@ -176,7 +157,6 @@ describe("Startup Validation", () => {
176
157
test ( "should throw an error for invalid type defs when validate is true, and warn will not be reached" , async ( ) => {
177
158
const neoSchema = new Neo4jGraphQL ( {
178
159
typeDefs : invalidAndCustomResolverTypeDefs ,
179
- driver,
180
160
validate : true ,
181
161
} ) ;
182
162
@@ -187,7 +167,6 @@ describe("Startup Validation", () => {
187
167
test ( "should throw no errors when validate is false, but warn for custom resolvers" , async ( ) => {
188
168
const neoSchema = new Neo4jGraphQL ( {
189
169
typeDefs : invalidAndCustomResolverTypeDefs ,
190
- driver,
191
170
validate : false ,
192
171
} ) ;
193
172
@@ -199,7 +178,6 @@ describe("Startup Validation", () => {
199
178
test ( "should throw an error for duplicate relationship fields when validate is true" , async ( ) => {
200
179
const neoSchema = new Neo4jGraphQL ( {
201
180
typeDefs : invalidDuplicateRelationship ,
202
- driver,
203
181
validate : true ,
204
182
} ) ;
205
183
@@ -213,7 +191,6 @@ describe("Startup Validation", () => {
213
191
test ( "should not throw an error for duplicate relationship fields validate is false" , async ( ) => {
214
192
const neoSchema = new Neo4jGraphQL ( {
215
193
typeDefs : invalidDuplicateRelationship ,
216
- driver,
217
194
validate : false ,
218
195
} ) ;
219
196
@@ -223,7 +200,6 @@ describe("Startup Validation", () => {
223
200
test ( "should throw no errors when validate is false" , async ( ) => {
224
201
const neoSchema = new Neo4jGraphQL ( {
225
202
typeDefs : invalidAll ,
226
- driver,
227
203
validate : false ,
228
204
} ) ;
229
205
0 commit comments