11describe ( 'WebRTC API' , function ( ) {
22 'use strict' ;
3-
4- var session ,
5- LOGIN_TIMEOUT = 10000 ;
3+ var LOGIN_TIMEOUT = 10000 ;
4+
5+ var isNodeEnv = typeof window === 'undefined' && typeof exports === 'object' ;
6+
7+ var QB = isNodeEnv ? require ( '../js/qbMain' ) : window . QB ;
8+ var CREDENTIALS = isNodeEnv ? require ( './config' ) . CREDENTIALS : window . CREDENTIALS ;
9+ var CONFIG = isNodeEnv ? require ( './config' ) . CONFIG : window . CONFIG ;
10+ var QBUser1 = isNodeEnv ? require ( './config' ) . QBUser1 : window . QBUser1 ;
11+ var QBUser2 = isNodeEnv ? require ( './config' ) . QBUser2 : window . QBUser2 ;
12+
13+ var session ;
614
715 beforeAll ( function ( done ) {
816 QB . init ( CREDENTIALS . appId , CREDENTIALS . authKey , CREDENTIALS . authSecret ) ;
@@ -16,8 +24,11 @@ describe('WebRTC API', function() {
1624 } ) ;
1725 } , LOGIN_TIMEOUT ) ;
1826
19-
2027 it ( 'can create a session' , function ( ) {
28+ if ( isNodeEnv ) {
29+ pending ( 'WebRTC API isn\'t supported outside of the browser' ) ;
30+ }
31+
2132 session = QB . webrtc . createNewSession ( [ QBUser2 . id ] , QB . webrtc . CallType . VIDEO ) ;
2233
2334 expect ( session ) . not . toBeNull ( ) ;
@@ -27,6 +38,10 @@ describe('WebRTC API', function() {
2738
2839
2940 it ( 'can not create a session with the same opponents' , function ( ) {
41+ if ( isNodeEnv ) {
42+ pending ( 'WebRTC API isn\'t supported outside of the browser' ) ;
43+ }
44+
3045 var errorString = 'Can\'t create a session with the same opponentsIDs. There is a session already in NEW or ACTIVE state.' ;
3146
3247 expect ( function ( ) {
0 commit comments