Skip to content

Commit

Permalink
adjust test
Browse files Browse the repository at this point in the history
  • Loading branch information
Lms24 committed Jan 17, 2023
1 parent 01f8566 commit 5f4da9e
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions packages/replay/test/unit/util/prepareReplayEvent.test.ts
Expand Up @@ -18,6 +18,19 @@ describe('Unit | util | prepareReplayEvent', () => {

client = hub.getClient()!;
scope = hub.getScope()!;

jest.spyOn(client, 'getSdkMetadata').mockImplementation(() => {
return {
sdk: {
name: 'sentry.javascript.testSdk',
version: '1.0.0',
},
};
});
});

afterEach(() => {
jest.clearAllMocks();
});

it('works', async () => {
Expand All @@ -39,6 +52,8 @@ describe('Unit | util | prepareReplayEvent', () => {

const replayEvent = await prepareReplayEvent({ scope, client, replayId, event });

expect(client.getSdkMetadata).toHaveBeenCalledTimes(1);

expect(replayEvent).toEqual({
type: 'replay_event',
timestamp: 1670837008.634,
Expand All @@ -52,8 +67,8 @@ describe('Unit | util | prepareReplayEvent', () => {
event_id: 'replay-ID',
environment: 'production',
sdk: {
name: 'sentry.javascript.unknown',
version: 'version:Test',
name: 'sentry.javascript.testSdk',
version: '1.0.0',
},
sdkProcessingMetadata: {},
breadcrumbs: undefined,
Expand Down

0 comments on commit 5f4da9e

Please sign in to comment.