@@ -6,8 +6,19 @@ describe('Chat API', function() {
66 var IQ_TIMEOUT = 1000 ;
77 var REST_REQUESTS_TIMEOUT = 3000 ;
88
9+ var isNodeEnv = typeof window === 'undefined' && typeof exports === 'object' ;
10+
11+ var QB = isNodeEnv ? require ( '../js/qbMain' ) : window . QB ;
12+ var CREDENTIALS = isNodeEnv ? require ( './config' ) . CREDENTIALS : window . CREDENTIALS ;
13+ var QBUser1 = isNodeEnv ? require ( './config' ) . QBUser1 : window . QBUser1 ;
14+ var QBUser2 = isNodeEnv ? require ( './config' ) . QBUser2 : window . QBUser2 ;
15+
916 describe ( 'XMPP (real time messaging)' , function ( ) {
1017
18+ if ( isNodeEnv ) {
19+ pending ( 'This describe "XMPP - real time messaging" isn\'t supported outside of the browser' ) ;
20+ }
21+
1122 beforeAll ( function ( done ) {
1223 QB . init ( CREDENTIALS . appId , CREDENTIALS . authKey , CREDENTIALS . authSecret , CONFIG ) ;
1324
@@ -455,9 +466,7 @@ describe('Chat API', function() {
455466 } ) ;
456467 } , REST_REQUESTS_TIMEOUT ) ;
457468
458- it ( 'can delete a message' , function ( done ) {
459- console . log ( "messageId: " + messageId ) ;
460-
469+ it ( 'can delete a message with id ' , function ( done ) {
461470 QB . chat . message . delete ( [ messageId , "notExistentId" ] , { force : 1 } , function ( err , res ) {
462471 if ( err ) {
463472 done . fail ( "Delete message " + messageId + " error: " + JSON . stringify ( err ) ) ;
0 commit comments