1
1
'use strict' ;
2
2
3
- describe ( 'errors' , function ( ) {
3
+ fdescribe ( 'errors' , function ( ) {
4
4
var originalObjectMaxDepthInErrorMessage = minErrConfig . objectMaxDepth ;
5
+ var originalUrlErrorParamsEnabled = minErrConfig . urlErrorParamsEnabled ;
5
6
6
7
afterEach ( function ( ) {
7
8
minErrConfig . objectMaxDepth = originalObjectMaxDepthInErrorMessage ;
9
+ minErrConfig . urlErrorParamsEnabled = originalUrlErrorParamsEnabled ;
8
10
} ) ;
9
11
10
12
describe ( 'errorHandlingConfig' , function ( ) {
11
- it ( 'should get default objectMaxDepth' , function ( ) {
12
- expect ( errorHandlingConfig ( ) . objectMaxDepth ) . toBe ( 5 ) ;
13
- } ) ;
13
+ describe ( 'objectMaxDepth' , function ( ) {
14
+ it ( 'should get default objectMaxDepth' , function ( ) {
15
+ expect ( errorHandlingConfig ( ) . objectMaxDepth ) . toBe ( 5 ) ;
16
+ } ) ;
17
+
18
+ it ( 'should set objectMaxDepth' , function ( ) {
19
+ errorHandlingConfig ( { objectMaxDepth : 3 } ) ;
20
+ expect ( errorHandlingConfig ( ) . objectMaxDepth ) . toBe ( 3 ) ;
21
+ } ) ;
14
22
15
- it ( 'should set objectMaxDepth' , function ( ) {
16
- errorHandlingConfig ( { objectMaxDepth : 3 } ) ;
17
- expect ( errorHandlingConfig ( ) . objectMaxDepth ) . toBe ( 3 ) ;
23
+ it ( 'should not change objectMaxDepth when undefined is supplied' , function ( ) {
24
+ errorHandlingConfig ( { objectMaxDepth : undefined } ) ;
25
+ expect ( errorHandlingConfig ( ) . objectMaxDepth ) . toBe ( originalObjectMaxDepthInErrorMessage ) ;
26
+ } ) ;
27
+
28
+ they ( 'should set objectMaxDepth to NaN when $prop is supplied' ,
29
+ [ NaN , null , true , false , - 1 , 0 ] , function ( maxDepth ) {
30
+ errorHandlingConfig ( { objectMaxDepth : maxDepth } ) ;
31
+ expect ( errorHandlingConfig ( ) . objectMaxDepth ) . toBeNaN ( ) ;
32
+ }
33
+ ) ;
18
34
} ) ;
19
35
20
- it ( 'should not change objectMaxDepth when undefined is supplied' , function ( ) {
21
- errorHandlingConfig ( { objectMaxDepth : undefined } ) ;
22
- expect ( errorHandlingConfig ( ) . objectMaxDepth ) . toBe ( originalObjectMaxDepthInErrorMessage ) ;
36
+
37
+ describe ( 'urlErrorParamsEnabled' , function ( ) {
38
+
39
+ it ( 'should get default urlErrorParamsEnabled' , function ( ) {
40
+ expect ( errorHandlingConfig ( ) . urlErrorParamsEnabled ) . toBe ( true ) ;
41
+ } ) ;
42
+
43
+ it ( 'should set urlErrorParamsEnabled' , function ( ) {
44
+ errorHandlingConfig ( { urlErrorParamsEnabled : false } ) ;
45
+ expect ( errorHandlingConfig ( ) . urlErrorParamsEnabled ) . toBe ( false ) ;
46
+ errorHandlingConfig ( { urlErrorParamsEnabled : true } ) ;
47
+ expect ( errorHandlingConfig ( ) . urlErrorParamsEnabled ) . toBe ( true ) ;
48
+ } ) ;
49
+
50
+ it ( 'should not change its value when non-boolean is supplied' , function ( ) {
51
+ errorHandlingConfig ( { urlErrorParamsEnabled : 123 } ) ;
52
+ expect ( errorHandlingConfig ( ) . urlErrorParamsEnabled ) . toBe ( originalUrlErrorParamsEnabled ) ;
53
+ } ) ;
23
54
} ) ;
24
55
25
- they ( 'should set objectMaxDepth to NaN when $prop is supplied' ,
26
- [ NaN , null , true , false , - 1 , 0 ] , function ( maxDepth ) {
27
- errorHandlingConfig ( { objectMaxDepth : maxDepth } ) ;
28
- expect ( errorHandlingConfig ( ) . objectMaxDepth ) . toBeNaN ( ) ;
29
- }
30
- ) ;
31
56
} ) ;
32
57
33
58
describe ( 'minErr' , function ( ) {
@@ -165,7 +190,6 @@ describe('errors', function() {
165
190
. toMatch ( / ^ [ \s \S ] * \? p 0 = a & p 1 = b & p 2 = v a l u e % 2 0 w i t h % 2 0 s p a c e $ / ) ;
166
191
} ) ;
167
192
168
-
169
193
it ( 'should strip error reference urls from the error message parameters' , function ( ) {
170
194
var firstError = testError ( 'firstcode' , 'longer string and so on' ) ;
171
195
@@ -177,5 +201,13 @@ describe('errors', function() {
177
201
'%3A%2F%2Ferrors.angularjs.org%2F%22NG_VERSION_FULL%22%2Ftest%2Ffirstcode' ) ;
178
202
} ) ;
179
203
204
+ it ( 'should not generate URL query parameters when urlErrorParamsEnabled is false' , function ( ) {
205
+
206
+ errorHandlingConfig ( { urlErrorParamsEnabled : false } ) ;
207
+
208
+ expect ( testError ( 'acode' , 'aproblem' , 'a' , 'b' , 'c' ) . message ) . toBe ( '[test:acode] aproblem\n' +
209
+ 'https://errors.angularjs.org/"NG_VERSION_FULL"/test/acode' ) ;
210
+ } ) ;
211
+
180
212
} ) ;
181
213
} ) ;
0 commit comments