Skip to content

Commit

Permalink
add missing authentication mock on cookies page integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
harley-harris committed Mar 28, 2024
1 parent 77a647a commit d038a08
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/integration/routes/cookies.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
jest.mock('../../../src/middleware/logger.middleware');
jest.mock('../../../src/middleware/authentication.middleware');
jest.mock('../../../src/utils/logger');

import { jest, beforeEach, describe, expect, test } from '@jest/globals';
Expand All @@ -8,11 +9,14 @@ import request from 'supertest';
import app from '../../../src/app';
import * as config from '../../../src/config';
import { logger } from '../../../src/middleware/logger.middleware';
import { authentication } from '../../../src/middleware/authentication.middleware';

import { MOCK_COOKIES_RESPONSE } from '../../mock/text.mock';

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>;
mockedAuth.mockImplementation((_req: Request, _res: Response, next: NextFunction) => next());

describe('Cookies endpoint integration tests', () => {
beforeEach(() => {
Expand All @@ -25,6 +29,7 @@ describe('Cookies endpoint integration tests', () => {

expect(res.text).toContain(MOCK_COOKIES_RESPONSE);
expect(mockedLogger).toHaveBeenCalledTimes(1);
expect(mockedAuth).toHaveBeenCalledTimes(1);
});
});
});

0 comments on commit d038a08

Please sign in to comment.