@@ -342,18 +342,10 @@ describe('Room methods', function () {
342342      room . callback  =  sinon . stub ( ) ; 
343343    } ) ; 
344344
345-     it ( 'should call back with an error if query returns an error' ,  function  ( )  { 
346-       notifCB . call ( room ,  { error : 'foobar' ,  result : { } } ) ; 
347-       should ( room . callback ) 
348-         . be . calledOnce ( ) 
349-         . be . calledWith ( 'foobar' ) ; 
350-       should ( room . callback . firstCall . args ) 
351-         . have . length ( 1 ) ; 
352-     } ) ; 
353- 
354345    it ( 'should handle document notifications' ,  function  ( )  { 
355346      notifCB . call ( room ,  { 
356347        controller : 'document' , 
348+         type : 'document' , 
357349        result : { 
358350          _id : 'id' , 
359351          _source : { 
@@ -382,6 +374,7 @@ describe('Room methods', function () {
382374      notifCB . call ( room ,  { 
383375        controller : 'realtime' , 
384376        action : 'publish' , 
377+         type : 'document' , 
385378        result : { 
386379          _source : { 
387380            foo : 'bar' 
@@ -409,7 +402,8 @@ describe('Room methods', function () {
409402    it ( 'should handle user notifications' ,  function  ( )  { 
410403      notifCB . call ( room ,  { 
411404        controller : 'realtime' , 
412-         result : {  count : 3  } 
405+         result : {  count : 3  } , 
406+         type : 'user' 
413407      } ) ; 
414408
415409      should ( room . callback ) 
@@ -425,7 +419,7 @@ describe('Room methods', function () {
425419    it ( 'should delete the result from history if emitted by this instance' ,  function  ( )  { 
426420      room . subscribeToSelf  =  true ; 
427421      kuzzle . requestHistory . bar  =  { } ; 
428-       notifCB . call ( room ,  { error :  null ,  result : { } ,  action : 'foo' ,  requestId : 'bar' } ) ; 
422+       notifCB . call ( room ,  { type :  'document' ,  result : { } ,  action : 'foo' ,  requestId : 'bar' } ) ; 
429423
430424      should ( room . callback ) 
431425        . be . calledOnce ( ) ; 
@@ -435,18 +429,18 @@ describe('Room methods', function () {
435429    it ( 'should not forward the message if subscribeToSelf is false and the response comes from a query emitted by this instance' ,  function  ( )  { 
436430      room . subscribeToSelf  =  false ; 
437431      kuzzle . requestHistory . bar  =  { } ; 
438-       notifCB . call ( room ,  { error :  null ,  result : { } ,  requestId : 'bar' ,  action : 'foo' } ) ; 
432+       notifCB . call ( room ,  { type :  'document' ,  result : { } ,  requestId : 'bar' ,  action : 'foo' } ) ; 
439433
440434      should ( room . callback ) . not . be . called ( ) ; 
441435      should ( kuzzle . requestHistory ) . be . empty ( ) ; 
442436    } ) ; 
443437
444-     it ( 'should fire a "jwtTokenExpired " event when receiving a jwtTokenExpired  notification' ,  function  ( )  { 
438+     it ( 'should fire a "tokenExpired " event when receiving a TokenExpired  notification' ,  function  ( )  { 
445439      kuzzle . emitEvent  =  sinon . stub ( ) ; 
446440
447-       notifCB . call ( room ,  { error :  null ,   result :  { } ,   action :  'jwtTokenExpired '} ) ; 
441+       notifCB . call ( room ,  { type :  'TokenExpired '} ) ; 
448442      should ( kuzzle . emitEvent ) . be . calledOnce ( ) ; 
449-       should ( kuzzle . emitEvent ) . be . calledWith ( 'jwtTokenExpired ' ) ; 
443+       should ( kuzzle . emitEvent ) . be . calledWith ( 'tokenExpired ' ) ; 
450444    } ) ; 
451445  } ) ; 
452446} ) ; 
0 commit comments