@@ -145,7 +145,7 @@ describe('utils', () => {
145
145
sandbox = sinon . createSandbox ( ) ;
146
146
sandbox . stub ( utils , 'getBrowserCombinations' ) . returns ( [ 'a' , 'b' ] ) ;
147
147
} ) ;
148
-
148
+
149
149
afterEach ( ( ) => {
150
150
sandbox . restore ( ) ;
151
151
sinon . restore ( ) ;
@@ -1146,4 +1146,34 @@ describe('utils', () => {
1146
1146
expect ( utils . versionChangedMessage ( preferredVersion , actualVersion ) ) . to . eq ( message )
1147
1147
} ) ;
1148
1148
} )
1149
+
1150
+ describe ( '#isJSONInvalid' , ( ) => {
1151
+ it ( 'JSON is valid when error is parallel misconfiguration' , ( ) => {
1152
+ let error = constant . validationMessages . INVALID_PARALLELS_CONFIGURATION ;
1153
+ let args = { "parallels" : 4 }
1154
+ expect ( utils . isJSONInvalid ( error , args ) ) . to . eq ( false )
1155
+ } ) ;
1156
+
1157
+ it ( 'JSON is valid when local is not set for localhost url' , ( ) => {
1158
+ let error = constant . validationMessages . LOCAL_NOT_SET . replace ( "<baseUrlValue>" , "localhost:4000" ) ;
1159
+ expect ( utils . isJSONInvalid ( error , { } ) ) . to . eq ( false )
1160
+ } ) ;
1161
+
1162
+ it ( 'JSON is invalid for errors apart from Local or Prallell misconfiguration' , ( ) => {
1163
+ let error = constant . validationMessages . INCORRECT_AUTH_PARAMS ;
1164
+ expect ( utils . isJSONInvalid ( error , { } ) ) . to . eq ( true )
1165
+ } ) ;
1166
+ } )
1167
+
1168
+ describe ( '#deleteBaseUrlFromError' , ( ) => {
1169
+ it ( 'Replace baseUrl in Local error string' , ( ) => {
1170
+ let error = constant . validationMessages . LOCAL_NOT_SET ;
1171
+ expect ( utils . deleteBaseUrlFromError ( error ) ) . to . match ( / T o t e s t o n B r o w s e r S t a c k / )
1172
+ } ) ;
1173
+
1174
+ it ( 'should not replace baseUrl in other error string' , ( ) => {
1175
+ let error = constant . validationMessages . NOT_VALID_JSON ;
1176
+ expect ( utils . deleteBaseUrlFromError ( error ) ) . not . to . match ( / T o t e s t o n B r o w s e r S t a c k / )
1177
+ } ) ;
1178
+ } ) ;
1149
1179
} ) ;
0 commit comments