Skip to content

Commit

Permalink
chore: Update Sentry to 8.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Mintoo200 committed May 23, 2024
1 parent 6cd866f commit cb3358c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"dependencies": {
"@meilisearch/instant-meilisearch": "0.17.0",
"@next/bundle-analyzer": "14.2.3",
"@sentry/nextjs": "8.1.0",
"@sentry/nextjs": "8.3.0",
"axios": "1.6.8",
"axios-cache-interceptor": "1.5.2",
"classnames": "2.5.1",
Expand Down
21 changes: 9 additions & 12 deletions src/pages/api/alternances/[id].controller.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { configureScope } from '@sentry/nextjs';
import * as Sentry from '@sentry/nextjs';
import { testApiHandler } from 'next-test-api-route-handler';
import nock from 'nock';

Expand All @@ -11,19 +11,15 @@ import {

import getAlternanceHandler from './[id].controller';

jest.mock('@sentry/nextjs', () => {
const sentry = jest.requireActual('@sentry/nextjs');
jest.mock('@sentry/nextjs');

return ({
...sentry,
configureScope: jest.fn(),
});
});
const SentryMock = jest.mocked(Sentry, { shallow: true });
const SentryScopeMock = {
setTag: jest.fn(),
} as unknown as Sentry.Scope;
SentryMock.getCurrentScope.mockReturnValue(SentryScopeMock);

describe('rechercher alternance', () => {
beforeEach(() => {
(configureScope as jest.Mock).mockClear();
});
it('retourne une alternance', async () => {
const alternanceId = '63c53c3566193e05691e9ce1';
nock('https://labonnealternance-recette.apprentissage.beta.gouv.fr/api/v1/').get(
Expand Down Expand Up @@ -57,6 +53,7 @@ describe('rechercher alternance', () => {
},
url: `/alternances/${alternanceId}`,
});
expect(configureScope).toHaveBeenCalledTimes(1);
expect(SentryMock.getCurrentScope).toHaveBeenCalledTimes(1);
expect(SentryScopeMock.setTag).toHaveBeenCalled();
});
});

0 comments on commit cb3358c

Please sign in to comment.