@@ -77,6 +77,30 @@ describe('Lib', function () {
77
77
} ) . run ( next ) ;
78
78
} ) ;
79
79
80
+ it ( 'should raise an error correctly' , function ( next ) {
81
+ var task = createExecuteTask ( {
82
+ parameters : {
83
+ types : [ TypeCode . INT ] ,
84
+ values : [
85
+ [ 1 ] ,
86
+ [ 2 ] ,
87
+ [ 3 ]
88
+ ]
89
+ } ,
90
+ replies : [ {
91
+ type : MessageType . EXECUTE ,
92
+ args : [ null , {
93
+ rowsAffected : [ 1 , 1 , 1 ]
94
+ } ]
95
+ } ]
96
+ } , function done ( err ) {
97
+ err . should . be . an . instanceOf ( Error ) ;
98
+ } ,
99
+ false ) ;
100
+ task . writer . _types = undefined ;
101
+ task . run ( next ) ;
102
+ } ) ;
103
+
80
104
it ( 'should run a batch task with INT type' , function ( next ) {
81
105
createExecuteTask ( {
82
106
parameters : {
@@ -323,7 +347,7 @@ describe('Lib', function () {
323
347
} ) ;
324
348
} ) ;
325
349
326
- function createExecuteTask ( options , cb ) {
350
+ function createExecuteTask ( options , cb , checkReplies ) {
327
351
options = util . extend ( {
328
352
parameters : {
329
353
types : [ TypeCode . INT ] ,
@@ -339,8 +363,11 @@ function createExecuteTask(options, cb) {
339
363
var connection = new Connection ( options . availableSize , options . replies ) ;
340
364
options . availableSize = undefined ;
341
365
options . replies = undefined ;
366
+ if ( checkReplies === undefined ) checkReplies = true ;
342
367
return ExecuteTask . create ( connection , options , function ( ) {
343
- connection . replies . should . have . length ( 0 ) ;
368
+ if ( checkReplies ) {
369
+ connection . replies . should . have . length ( 0 ) ;
370
+ }
344
371
cb . apply ( null , arguments ) ;
345
372
} ) ;
346
373
}
0 commit comments