File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -25,11 +25,21 @@ describe('Api.logout() method', function() {
2525
2626 it ( 'should remove sessionID from headers if logout was ok' , function ( done ) {
2727 api . httpOptions . headers . sessionID = 123 ;
28- api . request . resolves ( true ) ;
28+ api . request . resolves ( { success : true } ) ;
2929 var promise = api . logout ( ) ;
3030 expect ( promise ) . to . be . fulfilled . then ( function ( ) {
3131 expect ( api . httpOptions . headers . sessionID ) . to . equal ( undefined ) ;
3232 done ( ) ;
3333 } ) ;
3434 } ) ;
35+
36+ it ( 'should reject returned promise and dont touch sessionID if logout was not ok' , function ( done ) {
37+ api . httpOptions . headers . sessionID = 123 ;
38+ api . request . resolves ( false ) ;
39+ var promise = api . logout ( ) ;
40+ expect ( promise ) . to . be . rejected . then ( function ( ) {
41+ expect ( api . httpOptions . headers . sessionID ) . to . equal ( 123 ) ;
42+ done ( ) ;
43+ } ) ;
44+ } ) ;
3545} ) ;
You can’t perform that action at this time.
0 commit comments