@@ -321,6 +321,13 @@ describe('globals', function() {
321
321
logDebug ( level , message ) ;
322
322
assert . isTrue ( console [ level ] . calledOnce ) ;
323
323
} ) ;
324
+
325
+ it ( 'should write to console when force is true, even if Raven.debug is false' , function ( ) {
326
+ Raven . debug = false ;
327
+ this . sinon . stub ( console , level ) ;
328
+ logDebug ( level , message , true ) ;
329
+ assert . isTrue ( console [ level ] . calledOnce ) ;
330
+ } ) ;
324
331
} ) ;
325
332
326
333
describe ( 'setAuthQueryString' , function ( ) {
@@ -817,15 +824,6 @@ describe('globals', function() {
817
824
} ) ;
818
825
819
826
describe ( 'send' , function ( ) {
820
- it ( 'should check `isSetup`' , function ( ) {
821
- this . sinon . stub ( window , 'isSetup' ) . returns ( false ) ;
822
- this . sinon . stub ( window , 'makeRequest' ) ;
823
-
824
- send ( ) ;
825
- assert . isTrue ( window . isSetup . calledOnce ) ;
826
- assert . isFalse ( window . makeRequest . calledOnce ) ;
827
- } ) ;
828
-
829
827
it ( 'should build a good data payload' , function ( ) {
830
828
this . sinon . stub ( window , 'isSetup' ) . returns ( true ) ;
831
829
this . sinon . stub ( window , 'makeRequest' ) ;
@@ -1078,23 +1076,37 @@ describe('globals', function() {
1078
1076
extra : { 'session:duration' : 100 }
1079
1077
} ) ;
1080
1078
} ) ;
1081
-
1082
- it ( 'should log to console if not configured' , function ( ) {
1079
+ } ) ;
1080
+
1081
+ describe ( 'makeRequest' , function ( ) {
1082
+ it ( 'should check `isSetup`' , function ( ) {
1083
1083
this . sinon . stub ( window , 'isSetup' ) . returns ( false ) ;
1084
- this . sinon . stub ( console , 'log' ) ;
1085
- send ( { foo : 'bar' } ) ;
1086
- assert . isTrue ( console . log . called ) ;
1084
+ makeRequest ( { foo : 'bar' } ) ;
1085
+ assert . isTrue ( window . isSetup . called ) ;
1086
+ } ) ;
1087
+
1088
+ it ( 'should not create the image if `isSetup` is false' , function ( ) {
1089
+ this . sinon . stub ( window , 'isSetup' ) . returns ( false ) ;
1090
+ this . sinon . stub ( window , 'newImage' ) ;
1091
+ makeRequest ( { foo : 'bar' } ) ;
1092
+ assert . isFalse ( window . newImage . called ) ;
1087
1093
} ) ;
1088
-
1089
- it ( 'should NOT log to console if configured ' , function ( ) {
1094
+
1095
+ it ( 'should log to console' , function ( ) {
1090
1096
this . sinon . stub ( window , 'isSetup' ) . returns ( true ) ;
1091
- this . sinon . stub ( console , 'log' ) ;
1092
- send ( { foo : 'bar' } ) ;
1093
- assert . isFalse ( console . log . called ) ;
1097
+ this . sinon . stub ( window , 'logDebug' ) ;
1098
+ makeRequest ( { foo : 'bar' } ) ;
1099
+ assert . isTrue ( window . logDebug . called ) ;
1100
+ } ) ;
1101
+
1102
+ it ( 'should log to console, forcing output if isSetup is false' , function ( ) {
1103
+ this . sinon . stub ( window , 'isSetup' ) . returns ( false ) ;
1104
+ this . sinon . stub ( window , 'logDebug' ) ;
1105
+ makeRequest ( { foo : 'bar' } ) ;
1106
+ assert . isTrue ( window . logDebug . called ) ;
1107
+ assert . isTrue ( window . logDebug . args [ 0 ] [ 2 ] , 'logDebug should have been called with force=true' ) ;
1094
1108
} ) ;
1095
- } ) ;
1096
1109
1097
- describe ( 'makeRequest' , function ( ) {
1098
1110
it ( 'should load an Image' , function ( ) {
1099
1111
authQueryString = '?lol' ;
1100
1112
globalServer = 'http://localhost/' ;
0 commit comments