Skip to content

Commit

Permalink
rename migration to release date, update middleware in test
Browse files Browse the repository at this point in the history
Signed-off-by: Jason Sherman <[email protected]>
  • Loading branch information
usingtechnology committed Apr 19, 2024
1 parent f8b1597 commit fc3ebb7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions app/tests/unit/forms/submission/routes.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ const controller = require('../../../../src/forms/submission/controller');
// Mock out all the middleware - we're testing that the routes are set up
// correctly, not the functionality of the middleware.
//
const jwtService = require('../../../../src/components/jwtService');

//
// test assumes that caller has appropriate token, we are not testing middleware here...
//
jwtService.protect = jest.fn(() => {
return jest.fn((_req, _res, next) => {
next();
});
});

jest.mock('../../../../src/forms/auth/middleware/apiAccess');
apiAccess.mockImplementation(
Expand All @@ -33,6 +43,10 @@ const hasSubmissionPermissionsMock = jest.fn((_req, _res, next) => {
next();
});

userAccess.currentUser = jest.fn((_req, _res, next) => {
next();
});

userAccess.hasSubmissionPermissions = jest.fn(() => {
return hasSubmissionPermissionsMock;
});
Expand Down

0 comments on commit fc3ebb7

Please sign in to comment.