|
| 1 | +import { GLOBAL_OBJ } from '@sentry/utils'; |
1 | 2 | import { Transaction } from '../../../src';
|
2 | 3 | import type { ResourceEntry } from '../../../src/browser/metrics';
|
3 | 4 | import { _addMeasureSpans, _addResourceSpans } from '../../../src/browser/metrics';
|
| 5 | +import { WINDOW } from '../../../src/browser/types'; |
| 6 | + |
| 7 | +const mockWindowLocation = { |
| 8 | + ancestorOrigins: {}, |
| 9 | + href: "https://github.com/getsentry/sentry-javascript/pull/10205/files", |
| 10 | + origin: "https://github.com", |
| 11 | + protocol: "https:", |
| 12 | + host: "github.com", |
| 13 | + hostname: "github.com", |
| 14 | + port: "", |
| 15 | + pathname: "/getsentry/sentry-javascript/pull/10205/files", |
| 16 | + search: "", |
| 17 | + hash: "" |
| 18 | +} as Window['location']; |
| 19 | + |
| 20 | +WINDOW.location = mockWindowLocation; |
4 | 21 |
|
5 | 22 | describe('_addMeasureSpans', () => {
|
6 | 23 | // eslint-disable-next-line deprecation/deprecation
|
@@ -100,6 +117,9 @@ describe('_addResourceSpans', () => {
|
100 | 117 | ['http.response_content_length']: entry.encodedBodySize,
|
101 | 118 | ['http.response_transfer_size']: entry.transferSize,
|
102 | 119 | ['resource.render_blocking_status']: entry.renderBlockingStatus,
|
| 120 | + ['url.scheme']: WINDOW.location.protocol, |
| 121 | + ['server.address']: WINDOW.location.host, |
| 122 | + ['url.same_origin']: false, |
103 | 123 | },
|
104 | 124 | description: '/assets/to/css',
|
105 | 125 | endTimestamp: timeOrigin + startTime + duration,
|
|
0 commit comments