Skip to content

Commit 2743af0

Browse files
committed
cleanup
1 parent 4e7eed5 commit 2743af0

File tree

2 files changed

+8
-14
lines changed

2 files changed

+8
-14
lines changed

packages/react/src/profiler.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ function pushActivity(name: string, op: string): number | null {
5050

5151
/**
5252
* popActivity removes a React activity.
53-
* Is a no-op if invalid Tracing integration or invalid activity id.
53+
* Is a no-op if Tracing integration is not valid.
5454
* @param activity id of activity that is being popped
5555
*/
5656
function popActivity(activity: number | null): void {
@@ -64,11 +64,11 @@ function popActivity(activity: number | null): void {
6464

6565
/**
6666
* Obtain a span given an activity id.
67-
* Is a no-op if invalid Tracing integration.
67+
* Is a no-op if Tracing integration is not valid.
6868
* @param activity activity id associated with obtained span
6969
*/
7070
function getActivitySpan(activity: number | null): Span | undefined {
71-
if (globalTracingIntegration === null) {
71+
if (activity === null || globalTracingIntegration === null) {
7272
return undefined;
7373
}
7474

packages/react/test/profiler.test.tsx

+5-11
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,18 @@ import { renderHook } from '@testing-library/react-hooks';
44
import * as React from 'react';
55

66
import { UNKNOWN_COMPONENT, useProfiler, withProfiler } from '../src/profiler';
7-
/*(
8-
for key in SENTRY_FEATURES:
9-
SENTRY_FEATURES[key] = True
107

11-
SENTRY_APM_SAMPLING = 1
12-
)*/
138
const TEST_SPAN_ID = '518999beeceb49af';
9+
const TEST_TIMESTAMP = '123456';
1410

1511
const mockStartChild = jest.fn((spanArgs: SpanContext) => ({ ...spanArgs }));
16-
const TEST_SPAN = {
17-
spanId: TEST_SPAN_ID,
18-
startChild: mockStartChild,
19-
};
20-
const TEST_TIMESTAMP = '123456';
2112
const mockPushActivity = jest.fn().mockReturnValue(1);
2213
const mockPopActivity = jest.fn();
2314
const mockLoggerWarn = jest.fn();
24-
const mockGetActivitySpan = jest.fn().mockReturnValue(TEST_SPAN);
15+
const mockGetActivitySpan = jest.fn().mockReturnValue({
16+
spanId: TEST_SPAN_ID,
17+
startChild: mockStartChild,
18+
});
2519

2620
jest.mock('@sentry/utils', () => ({
2721
logger: {

0 commit comments

Comments
 (0)