diff --git a/packages/browser/test/unit/sdk.test.ts b/packages/browser/test/unit/sdk.test.ts index 4afac502c562..75b10d5c3ed3 100644 --- a/packages/browser/test/unit/sdk.test.ts +++ b/packages/browser/test/unit/sdk.test.ts @@ -1,6 +1,5 @@ /* eslint-disable @typescript-eslint/unbound-method */ import { createTransport, Scope } from '@sentry/core'; -import { MockIntegration } from '@sentry/core/test/lib/sdk.test'; import type { Client, Integration } from '@sentry/types'; import { resolvedSyncPromise } from '@sentry/utils'; @@ -18,6 +17,14 @@ function getDefaultBrowserOptions(options: Partial = {}): Browse }; } +export class MockIntegration implements Integration { + public name: string; + public setupOnce: () => void = jest.fn(); + public constructor(name: string) { + this.name = name; + } +} + jest.mock('@sentry/core', () => { const original = jest.requireActual('@sentry/core'); return { diff --git a/packages/core/src/exports.ts b/packages/core/src/exports.ts index 207cfde505b6..ba283914fbbd 100644 --- a/packages/core/src/exports.ts +++ b/packages/core/src/exports.ts @@ -196,17 +196,14 @@ export function startTransaction( * to create a monitor automatically when sending a check in. */ export function captureCheckIn(checkIn: CheckIn, upsertMonitorConfig?: MonitorConfig): string { - const capturedCheckIn = - checkIn.status !== 'in_progress' && checkIn.checkInId ? checkIn : { ...checkIn, checkInId: uuid4() }; - const client = getCurrentHub().getClient(); if (!client) { __DEBUG_BUILD__ && logger.warn('Cannot capture check-in. No client defined.'); } else if (!client.captureCheckIn) { __DEBUG_BUILD__ && logger.warn('Cannot capture check-in. Client does not support sending check-ins.'); } else { - client.captureCheckIn(capturedCheckIn, upsertMonitorConfig); + return client.captureCheckIn(checkIn, upsertMonitorConfig); } - return capturedCheckIn.checkInId; + return uuid4(); } diff --git a/packages/core/test/lib/sdk.test.ts b/packages/core/test/lib/sdk.test.ts index 46c694951ab2..afb1987262d9 100644 --- a/packages/core/test/lib/sdk.test.ts +++ b/packages/core/test/lib/sdk.test.ts @@ -47,7 +47,7 @@ describe('captureCheckIn', () => { } as unknown as Client; }); - expect(captureCheckIn({ monitorSlug: 'gogogo', status: 'in_progress' })).toStrictEqual(expect.any(String)); + expect(captureCheckIn({ monitorSlug: 'gogogo', status: 'in_progress' })).toStrictEqual('some-id-wasd-1234'); }); it('returns an id when client is undefined', () => {