Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
AbhiPrasad committed Jun 17, 2020
1 parent 4e7eed5 commit 2743af0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
6 changes: 3 additions & 3 deletions packages/react/src/profiler.tsx
Expand Up @@ -50,7 +50,7 @@ function pushActivity(name: string, op: string): number | null {

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

/**
* Obtain a span given an activity id.
* Is a no-op if invalid Tracing integration.
* Is a no-op if Tracing integration is not valid.
* @param activity activity id associated with obtained span
*/
function getActivitySpan(activity: number | null): Span | undefined {
if (globalTracingIntegration === null) {
if (activity === null || globalTracingIntegration === null) {
return undefined;
}

Expand Down
16 changes: 5 additions & 11 deletions packages/react/test/profiler.test.tsx
Expand Up @@ -4,24 +4,18 @@ import { renderHook } from '@testing-library/react-hooks';
import * as React from 'react';

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

SENTRY_APM_SAMPLING = 1
)*/
const TEST_SPAN_ID = '518999beeceb49af';
const TEST_TIMESTAMP = '123456';

const mockStartChild = jest.fn((spanArgs: SpanContext) => ({ ...spanArgs }));
const TEST_SPAN = {
spanId: TEST_SPAN_ID,
startChild: mockStartChild,
};
const TEST_TIMESTAMP = '123456';
const mockPushActivity = jest.fn().mockReturnValue(1);
const mockPopActivity = jest.fn();
const mockLoggerWarn = jest.fn();
const mockGetActivitySpan = jest.fn().mockReturnValue(TEST_SPAN);
const mockGetActivitySpan = jest.fn().mockReturnValue({
spanId: TEST_SPAN_ID,
startChild: mockStartChild,
});

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

0 comments on commit 2743af0

Please sign in to comment.