@@ -101,65 +101,65 @@ describe('BaseClient', () => {
101
101
const scope = new Scope ( ) ;
102
102
scope . addBreadcrumb ( { message : 'hello' } , 100 ) ;
103
103
client . addBreadcrumb ( { message : 'world' } , undefined , scope ) ;
104
- expect ( scope . getBreadcrumbs ( ) [ 1 ] . message ) . toBe ( 'world' ) ;
104
+ expect ( ( scope as any ) . breadcrumbs [ 1 ] . message ) . toBe ( 'world' ) ;
105
105
} ) ;
106
106
107
107
test ( 'adds a timestamp to new breadcrumbs' , ( ) => {
108
108
const client = new TestClient ( { } ) ;
109
109
const scope = new Scope ( ) ;
110
110
scope . addBreadcrumb ( { message : 'hello' } , 100 ) ;
111
111
client . addBreadcrumb ( { message : 'world' } , undefined , scope ) ;
112
- expect ( scope . getBreadcrumbs ( ) [ 1 ] . timestamp ) . toBeGreaterThan ( 1 ) ;
112
+ expect ( ( scope as any ) . breadcrumbs [ 1 ] . timestamp ) . toBeGreaterThan ( 1 ) ;
113
113
} ) ;
114
114
115
115
test ( 'discards breadcrumbs beyond maxBreadcrumbs' , ( ) => {
116
116
const client = new TestClient ( { maxBreadcrumbs : 1 } ) ;
117
117
const scope = new Scope ( ) ;
118
118
scope . addBreadcrumb ( { message : 'hello' } , 100 ) ;
119
119
client . addBreadcrumb ( { message : 'world' } , undefined , scope ) ;
120
- expect ( scope . getBreadcrumbs ( ) . length ) . toBe ( 1 ) ;
121
- expect ( scope . getBreadcrumbs ( ) [ 0 ] . message ) . toBe ( 'world' ) ;
120
+ expect ( ( scope as any ) . breadcrumbs . length ) . toBe ( 1 ) ;
121
+ expect ( ( scope as any ) . breadcrumbs [ 0 ] . message ) . toBe ( 'world' ) ;
122
122
} ) ;
123
123
124
124
test ( 'allows concurrent updates' , ( ) => {
125
125
const client = new TestClient ( { } ) ;
126
126
const scope = new Scope ( ) ;
127
127
client . addBreadcrumb ( { message : 'hello' } , undefined , scope ) ;
128
128
client . addBreadcrumb ( { message : 'world' } , undefined , scope ) ;
129
- expect ( scope . getBreadcrumbs ( ) ) . toHaveLength ( 2 ) ;
129
+ expect ( ( scope as any ) . breadcrumbs ) . toHaveLength ( 2 ) ;
130
130
} ) ;
131
131
132
132
test ( 'calls beforeBreadcrumb and adds the breadcrumb without any changes' , ( ) => {
133
133
const beforeBreadcrumb = jest . fn ( breadcrumb => breadcrumb ) ;
134
134
const client = new TestClient ( { beforeBreadcrumb } ) ;
135
135
const scope = new Scope ( ) ;
136
136
client . addBreadcrumb ( { message : 'hello' } , undefined , scope ) ;
137
- expect ( scope . getBreadcrumbs ( ) [ 0 ] . message ) . toBe ( 'hello' ) ;
137
+ expect ( ( scope as any ) . breadcrumbs [ 0 ] . message ) . toBe ( 'hello' ) ;
138
138
} ) ;
139
139
140
140
test ( 'calls beforeBreadcrumb and uses the new one' , ( ) => {
141
141
const beforeBreadcrumb = jest . fn ( ( ) => ( { message : 'changed' } ) ) ;
142
142
const client = new TestClient ( { beforeBreadcrumb } ) ;
143
143
const scope = new Scope ( ) ;
144
144
client . addBreadcrumb ( { message : 'hello' } , undefined , scope ) ;
145
- expect ( scope . getBreadcrumbs ( ) [ 0 ] . message ) . toBe ( 'changed' ) ;
145
+ expect ( ( scope as any ) . breadcrumbs [ 0 ] . message ) . toBe ( 'changed' ) ;
146
146
} ) ;
147
147
148
148
test ( 'calls beforeBreadcrumb and discards the breadcrumb when returned null' , ( ) => {
149
149
const beforeBreadcrumb = jest . fn ( ( ) => null ) ;
150
150
const client = new TestClient ( { beforeBreadcrumb } ) ;
151
151
const scope = new Scope ( ) ;
152
152
client . addBreadcrumb ( { message : 'hello' } , undefined , scope ) ;
153
- expect ( scope . getBreadcrumbs ( ) . length ) . toBe ( 0 ) ;
153
+ expect ( ( scope as any ) . breadcrumbs . length ) . toBe ( 0 ) ;
154
154
} ) ;
155
155
156
156
test ( 'calls beforeBreadcrumb gets an access to a hint as a second argument' , ( ) => {
157
157
const beforeBreadcrumb = jest . fn ( ( breadcrumb , hint ) => ( { ...breadcrumb , data : hint . data } ) ) ;
158
158
const client = new TestClient ( { beforeBreadcrumb } ) ;
159
159
const scope = new Scope ( ) ;
160
160
client . addBreadcrumb ( { message : 'hello' } , { data : 'someRandomThing' } , scope ) ;
161
- expect ( scope . getBreadcrumbs ( ) [ 0 ] . message ) . toBe ( 'hello' ) ;
162
- expect ( scope . getBreadcrumbs ( ) [ 0 ] . data ) . toBe ( 'someRandomThing' ) ;
161
+ expect ( ( scope as any ) . breadcrumbs [ 0 ] . message ) . toBe ( 'hello' ) ;
162
+ expect ( ( scope as any ) . breadcrumbs [ 0 ] . data ) . toBe ( 'someRandomThing' ) ;
163
163
} ) ;
164
164
} ) ;
165
165
0 commit comments