@@ -253,34 +253,37 @@ describe('# directives tests', () => {
253
253
let mutation = `mutation {
254
254
deleteTargetEdgeFromRequiredForTargetTest(id: "${ edgeId2 } ") { id }
255
255
}` ;
256
- await request ( url , mutation )
257
- . then ( ( ) => {
258
- throw new Error ( `@requiredForTarget directive should yield an error since no requiredForTarget edge will exist` ) ;
259
- } )
256
+ let result = await request ( url , mutation )
257
+ . then ( ( ) => new Error ( `@requiredForTarget directive should yield an error since no requiredForTarget edge will exist` ) )
260
258
. catch ( ( ) => null ) ;
259
+ if ( result ) {
260
+ throw result ;
261
+ }
261
262
} ) ;
262
263
263
264
it ( 'delete source of edge connecting to target' , async ( ) => {
264
265
// No more fields connecting to targetId1, mutation should fail
265
266
let mutation = `mutation {
266
267
deleteRequiredForTargetTest(id: "${ id2 } ") { id }
267
268
}` ;
268
- await request ( url , mutation )
269
- . then ( ( ) => {
270
- throw new Error ( `@requiredForTarget directive should yield an error since the source of edge (and edge) will cease to exist` ) ;
271
- } )
272
- . catch ( ( ) => null ) ;
269
+ let result = await request ( url , mutation )
270
+ . then ( ( ) => new Error ( `@requiredForTarget directive should yield an error since the source of edge (and edge) will cease to exist` ) )
271
+ . catch ( ( err ) => null ) ;
272
+ if ( result ) {
273
+ throw result ;
274
+ }
273
275
} ) ;
274
276
275
277
it ( 'create only target' , async ( ) => {
276
278
let mutation = `mutation {
277
279
createRequiredForTargetTarget(data:{ }) { id }
278
280
}` ;
279
- await request ( url , mutation )
280
- . then ( ( ) => {
281
- throw new Error ( `@requiredForTarget directive should yield an error when attempting to create objects out of order` ) ;
282
- } )
281
+ let result = await request ( url , mutation )
282
+ . then ( ( ) => new Error ( `@requiredForTarget directive should yield an error when attempting to create objects out of order` ) )
283
283
. catch ( ( ) => null ) ;
284
+ if ( result ) {
285
+ throw result ;
286
+ }
284
287
} ) ;
285
288
286
289
it ( 'create object and target using dependent mutations' , async ( ) => {
0 commit comments