@@ -188,23 +188,6 @@ describe('#integration transaction', () => {
188
188
)
189
189
} , 60000 )
190
190
191
- it ( 'should handle when committing when another query fails' , async ( ) => {
192
- // When
193
- const tx = session . beginTransaction ( )
194
-
195
- await expectAsync ( tx . run ( 'CREATE (:TXNode1)' ) ) . toBeResolved ( )
196
- await expectAsync ( tx . run ( 'THIS IS NOT CYHER' ) ) . toBeRejectedWith (
197
- jasmine . objectContaining ( {
198
- message : jasmine . stringMatching ( / I n v a l i d i n p u t / )
199
- } )
200
- )
201
- await expectAsync ( tx . commit ( ) ) . toBeRejectedWith (
202
- jasmine . objectContaining ( {
203
- message : jasmine . stringMatching ( / C a n n o t c o m m i t t h i s t r a n s a c t i o n / )
204
- } )
205
- )
206
- } , 60000 )
207
-
208
191
it ( 'should handle rollbacks' , done => {
209
192
const tx = session . beginTransaction ( )
210
193
tx . run ( 'CREATE (:TXNode1)' )
@@ -232,147 +215,6 @@ describe('#integration transaction', () => {
232
215
. catch ( console . log )
233
216
} , 60000 )
234
217
235
- it ( 'should fail when committing on a rolled back query' , async ( ) => {
236
- const tx = session . beginTransaction ( )
237
- await tx . run ( 'CREATE (:TXNode1)' )
238
- await tx . rollback ( )
239
-
240
- await expectAsync ( tx . commit ( ) ) . toBeRejectedWith (
241
- jasmine . objectContaining ( {
242
- message : jasmine . stringMatching (
243
- / C a n n o t c o m m i t t h i s t r a n s a c t i o n , b e c a u s e .* r o l l e d b a c k /
244
- )
245
- } )
246
- )
247
- } , 60000 )
248
-
249
- it ( 'should fail when running on a rolled back transaction' , async ( ) => {
250
- const tx = session . beginTransaction ( )
251
- await tx . run ( 'CREATE (:TXNode1)' )
252
- await tx . rollback ( )
253
-
254
- await expectAsync ( tx . run ( 'RETURN 42' ) ) . toBeRejectedWith (
255
- jasmine . objectContaining ( {
256
- message : jasmine . stringMatching (
257
- / C a n n o t r u n q u e r y i n t h i s t r a n s a c t i o n , b e c a u s e .* r o l l e d b a c k /
258
- )
259
- } )
260
- )
261
- } , 60000 )
262
-
263
- it ( 'should fail running when a previous query failed' , async ( ) => {
264
- const tx = session . beginTransaction ( )
265
-
266
- await expectAsync ( tx . run ( 'THIS IS NOT CYPHER' ) ) . toBeRejectedWith (
267
- jasmine . stringMatching ( / I n v a l i d i n p u t / )
268
- )
269
-
270
- await expectAsync ( tx . run ( 'RETURN 42' ) ) . toBeRejectedWith (
271
- jasmine . objectContaining ( {
272
- message : jasmine . stringMatching (
273
- / C a n n o t r u n q u e r y i n t h i s t r a n s a c t i o n , b e c a u s e .* a n e r r o r /
274
- )
275
- } )
276
- )
277
- await tx . rollback ( )
278
- } , 60000 )
279
-
280
- it ( 'should fail when trying to roll back a rolled back transaction' , async ( ) => {
281
- const tx = session . beginTransaction ( )
282
- await tx . run ( 'CREATE (:TXNode1)' )
283
- await tx . rollback ( )
284
-
285
- await expectAsync ( tx . rollback ( ) ) . toBeRejectedWith (
286
- jasmine . objectContaining ( {
287
- message : jasmine . stringMatching (
288
- / C a n n o t r o l l b a c k t h i s t r a n s a c t i o n , b e c a u s e .* r o l l e d b a c k /
289
- )
290
- } )
291
- )
292
- } , 60000 )
293
-
294
- it ( 'should provide bookmark on commit' , done => {
295
- // new session without initial bookmark
296
- session = driver . session ( )
297
- expect ( session . lastBookmark ( ) ) . toEqual ( [ ] )
298
-
299
- const tx = session . beginTransaction ( )
300
- tx . run ( 'CREATE (:TXNode1)' )
301
- . then ( ( ) => {
302
- tx . run ( 'CREATE (:TXNode2)' )
303
- . then ( ( ) => {
304
- tx . commit ( ) . then ( ( ) => {
305
- expectValidLastBookmark ( session )
306
- done ( )
307
- } )
308
- } )
309
- . catch ( console . log )
310
- } )
311
- . catch ( console . log )
312
- } , 60000 )
313
-
314
- it ( 'should have bookmark when tx is rolled back' , done => {
315
- // new session without initial bookmark
316
- session = driver . session ( )
317
- expect ( session . lastBookmark ( ) ) . toEqual ( [ ] )
318
-
319
- const tx1 = session . beginTransaction ( )
320
- tx1 . run ( 'CREATE ()' ) . then ( ( ) => {
321
- tx1 . commit ( ) . then ( ( ) => {
322
- expectValidLastBookmark ( session )
323
- const bookmarkBefore = session . lastBookmark ( )
324
-
325
- const tx2 = session . beginTransaction ( )
326
- tx2 . run ( 'CREATE ()' ) . then ( ( ) => {
327
- tx2 . rollback ( ) . then ( ( ) => {
328
- expectValidLastBookmark ( session )
329
- const bookmarkAfter = session . lastBookmark ( )
330
- expect ( bookmarkAfter ) . toEqual ( bookmarkBefore )
331
-
332
- const tx3 = session . beginTransaction ( )
333
- tx3 . run ( 'CREATE ()' ) . then ( ( ) => {
334
- tx3 . commit ( ) . then ( ( ) => {
335
- expectValidLastBookmark ( session )
336
- done ( )
337
- } )
338
- } )
339
- } )
340
- } )
341
- } )
342
- } )
343
- } , 60000 )
344
-
345
- it ( 'should have no bookmark when tx fails' , done => {
346
- // new session without initial bookmark
347
- session = driver . session ( )
348
- expect ( session . lastBookmark ( ) ) . toEqual ( [ ] )
349
-
350
- const tx1 = session . beginTransaction ( )
351
-
352
- tx1 . run ( 'CREATE ()' ) . then ( ( ) => {
353
- tx1 . commit ( ) . then ( ( ) => {
354
- expectValidLastBookmark ( session )
355
- const bookmarkBefore = session . lastBookmark ( )
356
-
357
- const tx2 = session . beginTransaction ( )
358
-
359
- tx2 . run ( 'RETURN' ) . catch ( error => {
360
- expectSyntaxError ( error )
361
- const bookmarkAfter = session . lastBookmark ( )
362
- expect ( bookmarkAfter ) . toEqual ( bookmarkBefore )
363
-
364
- const tx3 = session . beginTransaction ( )
365
- tx3 . run ( 'CREATE ()' ) . then ( ( ) => {
366
- tx3 . commit ( ) . then ( ( ) => {
367
- expectValidLastBookmark ( session )
368
- done ( )
369
- } )
370
- } )
371
- } )
372
- } )
373
- } )
374
- } , 60000 )
375
-
376
218
it ( 'should throw when provided string (bookmark) parameter' , ( ) => {
377
219
expect ( ( ) => session . beginTransaction ( 'bookmark' ) ) . toThrowError ( TypeError )
378
220
} , 60000 )
@@ -399,11 +241,10 @@ describe('#integration transaction', () => {
399
241
} )
400
242
const tx2 = session2 . beginTransaction ( )
401
243
tx2 . run ( 'CREATE ()' ) . catch ( error => {
402
- const message = error . message
403
244
// Checking message text on <= 4.0, check code for >= 4.1
404
245
expect (
405
246
error . message . includes ( 'not up to the requested version' ) ||
406
- error . code == 'Neo.ClientError.Transaction.InvalidBookmark'
247
+ error . code === 'Neo.ClientError.Transaction.InvalidBookmark'
407
248
) . toBeTruthy ( )
408
249
done ( )
409
250
} )
0 commit comments