Skip to content

Commit df84b36

Browse files
committed
add tests
1 parent db5473b commit df84b36

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

packages/tracing-internal/test/browser/metrics/index.test.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
1+
import { GLOBAL_OBJ } from '@sentry/utils';
12
import { Transaction } from '../../../src';
23
import type { ResourceEntry } from '../../../src/browser/metrics';
34
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;
421

522
describe('_addMeasureSpans', () => {
623
// eslint-disable-next-line deprecation/deprecation
@@ -100,6 +117,9 @@ describe('_addResourceSpans', () => {
100117
['http.response_content_length']: entry.encodedBodySize,
101118
['http.response_transfer_size']: entry.transferSize,
102119
['resource.render_blocking_status']: entry.renderBlockingStatus,
120+
['url.scheme']: WINDOW.location.protocol,
121+
['server.address']: WINDOW.location.host,
122+
['url.same_origin']: false,
103123
},
104124
description: '/assets/to/css',
105125
endTimestamp: timeOrigin + startTime + duration,

0 commit comments

Comments
 (0)