Skip to content

Commit 75ad86d

Browse files
committed
add new meta-header-reading test
1 parent 46119aa commit 75ad86d

File tree

1 file changed

+24
-15
lines changed

1 file changed

+24
-15
lines changed

packages/tracing/test/browser/browsertracing.test.ts

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -357,24 +357,33 @@ describe('BrowserTracing', () => {
357357
});
358358
});
359359

360-
describe('sentry-trace <meta> element', () => {
361-
describe('getMetaContent', () => {
362-
it('finds the specified tag and extracts the value', () => {
363-
const name = 'sentry-trace';
364-
const content = '126de09502ae4e0fb26c6967190756a4-b6e54397b12a2a0f-1';
365-
document.head.innerHTML = `<meta name="${name}" content="${content}">`;
366-
367-
const metaTagValue = getMetaContent(name);
368-
expect(metaTagValue).toBe(content);
369-
});
360+
describe('sentry-trace <meta> element', () => {
361+
describe('getMetaContent', () => {
362+
it('finds the specified tag and extracts the value', () => {
363+
const name = 'sentry-trace';
364+
const content = '126de09502ae4e0fb26c6967190756a4-b6e54397b12a2a0f-1';
365+
document.head.innerHTML = `<meta name="${name}" content="${content}">`;
370366

371-
it("doesn't return meta tags other than the one specified", () => {
372-
document.head.innerHTML = `<meta name="cat-cafe">`;
367+
const metaTagValue = getMetaContent(name);
368+
expect(metaTagValue).toBe(content);
369+
});
373370

374-
const metaTagValue = getMetaContent('dogpark');
375-
expect(metaTagValue).toBe(null);
376-
});
371+
it("doesn't return meta tags other than the one specified", () => {
372+
document.head.innerHTML = `<meta name="cat-cafe">`;
373+
374+
const metaTagValue = getMetaContent('dogpark');
375+
expect(metaTagValue).toBe(null);
376+
});
377+
378+
it('can pick the correct tag out of multiple options', () => {
379+
const name = 'sentry-trace';
380+
const content = '126de09502ae4e0fb26c6967190756a4-b6e54397b12a2a0f-1';
381+
const sentryTraceMeta = `<meta name="${name}" content="${content}">`;
382+
const otherMeta = `<meta name="cat-cafe">`;
383+
document.head.innerHTML = `${sentryTraceMeta} ${otherMeta}`;
377384

385+
const metaTagValue = getMetaContent(name);
386+
expect(metaTagValue).toBe(content);
378387
});
379388
});
380389
});

0 commit comments

Comments
 (0)