@@ -21,7 +21,11 @@ describe('checkForAllowedTrackingOrigins', () => {
2121 } )
2222
2323 it ( 'should not warn if not in extension environment' , ( ) => {
24- const result = isAllowedTrackingOrigins ( DEFAULT_CONFIG , 'https://app.example.com' )
24+ const result = isAllowedTrackingOrigins (
25+ DEFAULT_CONFIG ,
26+ 'Error: at https://example.com/script.js:1:1' ,
27+ 'https://app.example.com'
28+ )
2529 expect ( displayWarnSpy ) . not . toHaveBeenCalled ( )
2630 expect ( displayErrorSpy ) . not . toHaveBeenCalled ( )
2731 expect ( result ) . toBe ( true )
@@ -34,6 +38,7 @@ describe('checkForAllowedTrackingOrigins', () => {
3438 ...DEFAULT_CONFIG ,
3539 allowedTrackingOrigins : [ 'https://app.example.com' ] ,
3640 } ,
41+ 'Error: at https://example.com/script.js:1:1' ,
3742 'https://app.example.com'
3843 )
3944 expect ( displayWarnSpy ) . not . toHaveBeenCalled ( )
@@ -47,6 +52,7 @@ describe('checkForAllowedTrackingOrigins', () => {
4752 ...DEFAULT_CONFIG ,
4853 allowedTrackingOrigins : [ / ^ h t t p s : \/ \/ .* \. e x a m p l e \. c o m $ / ] ,
4954 } ,
55+ 'Error: at https://example.com/script.js:1:1' ,
5056 'https://app.example.com'
5157 )
5258 expect ( displayWarnSpy ) . not . toHaveBeenCalled ( )
@@ -60,6 +66,7 @@ describe('checkForAllowedTrackingOrigins', () => {
6066 ...DEFAULT_CONFIG ,
6167 allowedTrackingOrigins : [ ( origin : string ) => origin . includes ( 'example.com' ) ] ,
6268 } ,
69+ 'Error: at https://example.com/script.js:1:1' ,
6370 'https://app.example.com'
6471 )
6572 expect ( displayWarnSpy ) . not . toHaveBeenCalled ( )
@@ -77,6 +84,7 @@ describe('checkForAllowedTrackingOrigins', () => {
7784 ( origin : string ) => origin . startsWith ( 'https://app.' ) ,
7885 ] ,
7986 } ,
87+ 'Error: at https://example.com/script.js:1:1' ,
8088 'https://app.example.com'
8189 )
8290 expect ( displayWarnSpy ) . not . toHaveBeenCalled ( )
@@ -92,8 +100,8 @@ describe('checkForAllowedTrackingOrigins', () => {
92100 ...DEFAULT_CONFIG ,
93101 allowedTrackingOrigins : [ 'https://different.com' ] ,
94102 } ,
103+ 'Error: at chrome-extension://abcdefghijklmno/content.js:10:15' ,
95104 'https://example.com' ,
96- 'Error: at chrome-extension://abcdefghijklmno/content.js:10:15'
97105 )
98106 expect ( displayErrorSpy ) . toHaveBeenCalledWith ( ERROR_NOT_ALLOWED_TRACKING_ORIGIN )
99107 expect ( result ) . toBe ( false )
@@ -105,8 +113,8 @@ describe('checkForAllowedTrackingOrigins', () => {
105113 ...DEFAULT_CONFIG ,
106114 allowedTrackingOrigins : [ / ^ h t t p s : \/ \/ s p e c i f i c - [ a - z ] + \. c o m $ / ] ,
107115 } ,
108- 'https://example.com ' ,
109- 'Error: at chrome-extension://abcdefghijklmno/content.js:10:15 '
116+ 'Error: at chrome-extension://abcdefghijklmno/content.js:10:15 ' ,
117+ 'https://example.com '
110118 )
111119 expect ( displayErrorSpy ) . toHaveBeenCalledWith ( ERROR_NOT_ALLOWED_TRACKING_ORIGIN )
112120 expect ( result ) . toBe ( false )
@@ -118,8 +126,8 @@ describe('checkForAllowedTrackingOrigins', () => {
118126 ...DEFAULT_CONFIG ,
119127 allowedTrackingOrigins : [ ( origin : string ) => origin . includes ( 'specific-id' ) ] ,
120128 } ,
121- 'https://example.com ' ,
122- 'Error: at chrome-extension://abcdefghijklmno/content.js:10:15 '
129+ 'Error: at chrome-extension://abcdefghijklmno/content.js:10:15 ' ,
130+ 'https://example.com '
123131 )
124132 expect ( displayErrorSpy ) . toHaveBeenCalledWith ( ERROR_NOT_ALLOWED_TRACKING_ORIGIN )
125133 expect ( result ) . toBe ( false )
@@ -135,8 +143,8 @@ describe('checkForAllowedTrackingOrigins', () => {
135143 ( origin : string ) => origin . includes ( 'specific-id' ) ,
136144 ] ,
137145 } ,
138- 'https://example.com ' ,
139- 'Error: at chrome-extension://abcdefghijklmno/content.js:10:15 '
146+ 'Error: at chrome-extension://abcdefghijklmno/content.js:10:15 ' ,
147+ 'https://example.com '
140148 )
141149 expect ( displayErrorSpy ) . toHaveBeenCalledWith ( ERROR_NOT_ALLOWED_TRACKING_ORIGIN )
142150 expect ( result ) . toBe ( false )
@@ -148,8 +156,8 @@ describe('checkForAllowedTrackingOrigins', () => {
148156 ...DEFAULT_CONFIG ,
149157 allowedTrackingOrigins : [ 'https://example.com' ] ,
150158 } ,
151- 'https://example.com.extra.com ' ,
152- 'Error: at chrome-extension://abcdefghijklmno/content.js:10:15 '
159+ 'Error: at chrome-extension://abcdefghijklmno/content.js:10:15 ' ,
160+ 'https://example.com.extra.com '
153161 )
154162 expect ( displayErrorSpy ) . toHaveBeenCalledWith ( ERROR_NOT_ALLOWED_TRACKING_ORIGIN )
155163 expect ( result ) . toBe ( false )
@@ -161,8 +169,8 @@ describe('checkForAllowedTrackingOrigins', () => {
161169 ...DEFAULT_CONFIG ,
162170 allowedTrackingOrigins : [ / ^ c h r o m e - e x t e n s i o n : \/ \/ / ] ,
163171 } ,
164- 'chrome-extension://abcdefghijklmno' ,
165- 'Error: at chrome-extension://abcdefghijklmno/content.js:10:15 '
172+ 'Error: at chrome-extension://abcdefghijklmno/content.js:10:15 ' ,
173+ 'chrome-extension://abcdefghijklmno'
166174 )
167175 expect ( displayErrorSpy ) . not . toHaveBeenCalled ( )
168176 expect ( result ) . toBe ( true )
@@ -176,8 +184,8 @@ describe('checkForAllowedTrackingOrigins', () => {
176184 ...DEFAULT_CONFIG ,
177185 allowedTrackingOrigins : undefined ,
178186 } ,
179- 'https://example.com ' ,
180- 'Error: at chrome-extension://abcdefghijklmno/content.js:10:15 '
187+ 'Error: at chrome-extension://abcdefghijklmno/content.js:10:15 ' ,
188+ 'https://example.com '
181189 )
182190 expect ( displayWarnSpy ) . toHaveBeenCalledWith ( WARN_DOES_NOT_HAVE_ALLOWED_TRACKING_ORIGIN )
183191 expect ( result ) . toBe ( true )
@@ -189,8 +197,8 @@ describe('checkForAllowedTrackingOrigins', () => {
189197 ...DEFAULT_CONFIG ,
190198 allowedTrackingOrigins : [ ] ,
191199 } ,
192- 'https://example.com ' ,
193- 'Error: at chrome-extension://abcdefghijklmno/content.js:10:15 '
200+ 'Error: at chrome-extension://abcdefghijklmno/content.js:10:15 ' ,
201+ 'https://example.com '
194202 )
195203 expect ( displayErrorSpy ) . toHaveBeenCalledWith ( ERROR_NOT_ALLOWED_TRACKING_ORIGIN )
196204 expect ( result ) . toBe ( false )
@@ -202,8 +210,8 @@ describe('checkForAllowedTrackingOrigins', () => {
202210 ...DEFAULT_CONFIG ,
203211 allowedTrackingOrigins : undefined ,
204212 } ,
205- 'https://example.com' ,
206- 'Error: at https://example.com/script.js:10:15 '
213+ 'Error: at https://example.com/script.js:10:15 ' ,
214+ 'https://example.com'
207215 )
208216 expect ( displayWarnSpy ) . not . toHaveBeenCalled ( )
209217 expect ( displayErrorSpy ) . not . toHaveBeenCalled ( )
0 commit comments