@@ -14,14 +14,6 @@ describe('Utils', () => {
14
14
expect ( target ) . toEqual ( [ '3' , '1' , '2' ] ) ;
15
15
} ) ;
16
16
17
- it ( 'should stringify circular reference' , ( ) => {
18
- let afoo :any = { a : 'foo' } ;
19
- afoo . b = afoo ;
20
-
21
- expect ( Utils . stringify ( afoo ) ) . toBe ( '{"a":"foo"}' ) ;
22
- expect ( Utils . stringify ( [ { one : afoo , two : afoo } ] ) ) . toBe ( '[{"one":{"a":"foo"}}]' ) ;
23
- } ) ;
24
-
25
17
describe ( 'stringify' , ( ) => {
26
18
let user :any = {
27
19
id :1 ,
@@ -36,6 +28,51 @@ describe('Utils', () => {
36
28
}
37
29
} ;
38
30
31
+ it ( 'array' , ( ) => {
32
+ let error = {
33
+ 'type' : 'error' ,
34
+ 'data' : {
35
+ '@error' : {
36
+ 'type' : 'Error' ,
37
+ 'message' : 'string error message' ,
38
+ 'stack_trace' : [
39
+ {
40
+ 'name' : 'throwStringErrorImpl' ,
41
+ 'parameters' : [ ] ,
42
+ 'file_name' : 'http://localhost/index.js' ,
43
+ 'line_number' : 22 ,
44
+ 'column' : 9
45
+ } ,
46
+ {
47
+ 'name' : 'throwStringError' ,
48
+ 'parameters' : [ ] ,
49
+ 'file_name' : 'http://localhost/index.js' ,
50
+ 'line_number' : 10 ,
51
+ 'column' : 10
52
+ } , {
53
+ 'name' : 'HTMLButtonElement.onclick' ,
54
+ 'parameters' : [ ] ,
55
+ 'file_name' : 'http://localhost/' ,
56
+ 'line_number' : 22 ,
57
+ 'column' : 10
58
+ } ]
59
+ } , '@submission_method' : 'onerror'
60
+ } ,
61
+ 'tags' : [ ]
62
+ } ;
63
+
64
+ expect ( Utils . stringify ( error ) ) . toBe ( JSON . stringify ( error ) ) ;
65
+ expect ( Utils . stringify ( [ error , error ] ) ) . toBe ( JSON . stringify ( [ error , error ] ) ) ;
66
+ } ) ;
67
+
68
+ it ( 'circular reference' , ( ) => {
69
+ let afoo :any = { a : 'foo' } ;
70
+ afoo . b = afoo ;
71
+
72
+ expect ( Utils . stringify ( afoo ) ) . toBe ( '{"a":"foo"}' ) ;
73
+ expect ( Utils . stringify ( [ { one : afoo , two : afoo } ] ) ) . toBe ( '[{"one":{"a":"foo"}}]' ) ;
74
+ } ) ;
75
+
39
76
it ( 'should behave like JSON.stringify' , ( ) => {
40
77
expect ( Utils . stringify ( user ) ) . toBe ( JSON . stringify ( user ) ) ;
41
78
} ) ;
@@ -56,44 +93,12 @@ describe('Utils', () => {
56
93
it ( '*password*' , ( ) => {
57
94
expect ( Utils . stringify ( user , [ '*password*' ] ) ) . toBe ( '{"id":1,"name":"Blake","customValue":"Password","value":{}}' ) ;
58
95
} ) ;
59
- } ) ;
60
- } ) ;
61
96
62
- it ( 'should stringify array' , ( ) => {
63
- let error = {
64
- 'type' : 'error' ,
65
- 'data' : {
66
- '@error' : {
67
- 'type' : 'Error' ,
68
- 'message' : 'string error message' ,
69
- 'stack_trace' : [
70
- {
71
- 'name' : 'throwStringErrorImpl' ,
72
- 'parameters' : [ ] ,
73
- 'file_name' : 'http://localhost/index.js' ,
74
- 'line_number' : 22 ,
75
- 'column' : 9
76
- } ,
77
- {
78
- 'name' : 'throwStringError' ,
79
- 'parameters' : [ ] ,
80
- 'file_name' : 'http://localhost/index.js' ,
81
- 'line_number' : 10 ,
82
- 'column' : 10
83
- } , {
84
- 'name' : 'HTMLButtonElement.onclick' ,
85
- 'parameters' : [ ] ,
86
- 'file_name' : 'http://localhost/' ,
87
- 'line_number' : 22 ,
88
- 'column' : 10
89
- } ]
90
- } , '@submission_method' : 'onerror'
91
- } ,
92
- 'tags' : [ ]
93
- } ;
94
-
95
- expect ( Utils . stringify ( error ) ) . toBe ( JSON . stringify ( error ) ) ;
96
- expect ( Utils . stringify ( [ error , error ] ) ) . toBe ( JSON . stringify ( [ error , error ] ) ) ;
97
+ it ( '*Address' , ( ) => {
98
+ let event = { "type" :"usage" , "source" :"about" } ;
99
+ expect ( Utils . stringify ( event , [ '*Address' ] ) ) . toBe ( JSON . stringify ( event ) ) ;
100
+ } ) ;
101
+ } ) ;
97
102
} ) ;
98
103
99
104
it ( 'should parse version from url' , ( ) => {
0 commit comments