Skip to content

Commit

Permalink
Amend Jest
Browse files Browse the repository at this point in the history
  • Loading branch information
mel-am committed Feb 7, 2024
1 parent ccad87d commit 67e0845
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
7 changes: 1 addition & 6 deletions test/integration/routes/add-team-member.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
jest.mock('../../../src/utils/logger');
jest.mock('../../../src/middleware/logger.middleware');
jest.mock('../../../src/middleware/authentication.middleware');

Expand All @@ -14,12 +15,6 @@ import { authentication } from '../../../src/middleware/authentication.middlewar
import { MOCK_REDIRECT_MESSAGE, MOCK_POST_ADD_TEAM_MEMBER_RESPONSE, MOCK_GET_ADD_TEAM_MEMBER_RESPONSE as MOCK_GET_ADD_TEAM_MEMBER_RESPONSE } from '../../mock/text.mock';
import { MOCK_POST_ADD_TEAM_MEMBER } from '../../mock/data';

jest.mock('../../../src/utils/logger', () => ({
log: {
info: jest.fn()
}
}));

const mockedLogger = logger as jest.Mock<typeof logger>;
mockedLogger.mockImplementation((_req: Request, _res: Response, next: NextFunction) => next());
const mockedAuth = authentication as jest.Mock<typeof authentication>;
Expand Down
8 changes: 2 additions & 6 deletions test/unit/controller/add-team-member.controller.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
jest.mock('../../../src/utils/logger');

import { describe, expect, afterEach, test, jest } from '@jest/globals';
import { Request, Response } from 'express';

Expand All @@ -8,12 +10,6 @@ import { log } from '../../../src/utils/logger';
import { MOCK_POST_ADD_TEAM_MEMBER } from '../../mock/data';
import { MOCK_POST_ADD_TEAM_MEMBER_RESPONSE } from '../../mock/text.mock';

jest.mock('../../../src/utils/logger', () => ({
log: {
info: jest.fn()
}
}));

const req = {
body: MOCK_POST_ADD_TEAM_MEMBER
} as Request;
Expand Down

0 comments on commit 67e0845

Please sign in to comment.