@@ -25,7 +25,8 @@ describe('Kuzzle query management', function () {
2525 } ) ;
2626
2727 kuzzle = new Kuzzle ( 'foo' ) ;
28- } ) ;
28+ kuzzle . network . query . resolves ( { result :{ } } ) ;
29+ } ) ;
2930
3031 it ( 'should generate a valid request object with no "options" argument and no callback' , function ( ) {
3132 kuzzle . query ( queryArgs , queryBody ) ;
@@ -56,9 +57,7 @@ describe('Kuzzle query management', function () {
5657 } ) ;
5758
5859 it ( 'should manage arguments properly if no options are provided' , function ( ) {
59- var cb = sinon . stub ( ) ;
60-
61- kuzzle . query ( queryArgs , queryBody , cb ) ;
60+ kuzzle . query ( queryArgs , queryBody ) ;
6261 should ( kuzzle . network . query ) . be . calledOnce ( ) ;
6362 should ( kuzzle . network . query ) . be . calledWith ( {
6463 action : 'action' ,
@@ -68,13 +67,11 @@ describe('Kuzzle query management', function () {
6867 index : 'index' ,
6968 volatile : { sdkInstanceId : kuzzle . network . id , sdkVersion : kuzzle . sdkVersion } ,
7069 requestId : sinon . match ( / ^ [ 0 - 9 a - f ] { 8 } - [ 0 - 9 a - f ] { 4 } - [ 1 - 5 ] [ 0 - 9 a - f ] { 3 } - [ 8 9 a b ] [ 0 - 9 a - f ] { 3 } - [ 0 - 9 a - f ] { 12 } $ / i)
71- } , null , sinon . match ( function ( f ) { return f === cb ; } ) ) ;
70+ } ) ;
7271 } ) ;
7372
7473 it ( 'should manage arguments properly if empty query and no options are provided' , function ( ) {
75- var cb = sinon . stub ( ) ;
76-
77- kuzzle . query ( queryArgs , cb ) ;
74+ kuzzle . query ( queryArgs ) ;
7875 should ( kuzzle . network . query ) . be . calledOnce ( ) ;
7976 should ( kuzzle . network . query ) . be . calledWith ( {
8077 action : 'action' ,
@@ -83,7 +80,7 @@ describe('Kuzzle query management', function () {
8380 index : 'index' ,
8481 volatile : { sdkInstanceId : kuzzle . network . id , sdkVersion : kuzzle . sdkVersion } ,
8582 requestId : sinon . match ( / ^ [ 0 - 9 a - f ] { 8 } - [ 0 - 9 a - f ] { 4 } - [ 1 - 5 ] [ 0 - 9 a - f ] { 3 } - [ 8 9 a b ] [ 0 - 9 a - f ] { 3 } - [ 0 - 9 a - f ] { 12 } $ / i)
86- } , null , sinon . match ( function ( f ) { return f === cb ; } ) ) ;
83+ } ) ;
8784 } ) ;
8885
8986 it ( 'should not define optional members if none was provided' , function ( ) {
@@ -92,10 +89,10 @@ describe('Kuzzle query management', function () {
9289 should ( kuzzle . network . query ) . be . calledWithMatch ( { index : undefined } ) ;
9390 } ) ;
9491
95- it ( 'should invoke the callback with an error if no query is provided' , function ( ) {
96- should ( function ( ) { kuzzle . query ( queryArgs , [ 'foo' , 'bar' ] ) ; } ) . throw ( Error ) ;
97- should ( function ( ) { kuzzle . query ( queryArgs ) ; } ) . throw ( Error ) ;
98- should ( function ( ) { kuzzle . query ( queryArgs , 'foobar' ) ; } ) . throw ( Error ) ;
92+ it ( 'should reject if no query is provided' , function ( ) {
93+ should ( kuzzle . query ( queryArgs , [ 'foo' , 'bar' ] ) ) . be . rejected ( ) ;
94+ should ( kuzzle . query ( queryArgs ) ) . be . rejected ( ) ;
95+ should ( kuzzle . query ( queryArgs , 'foobar' ) ) . be . rejected ( ) ;
9996 } ) ;
10097
10198 it ( 'should handle options "volatile" properly' , function ( ) {
0 commit comments