Skip to content

Commit

Permalink
Fixing all other failed test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
udaysingh236 committed Sep 17, 2023
1 parent a933313 commit 76d4165
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 3 deletions.
16 changes: 15 additions & 1 deletion src/routes/employee.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,21 @@ import * as employeeController from '../controllers/employee.controller';
const mcheckUserLoggedIn = jest
.spyOn(auth, 'checkUserLoggedIn')
.mockImplementation((req, res, next) => {
req.user = 'john.doe'; //for testing bypassing the auth
//for testing bypassing the auth
req.user = {
username: 'john.doe',
connectedSocialAccounts: 0,
google: {
email: '',
profileId: '',
photoUrl: ''
},
github: {
email: '',
profileId: '',
photoUrl: ''
}
};
if (!req.user) {
return res.status(401).send({
error: 'You are not logged in..!!'
Expand Down
16 changes: 15 additions & 1 deletion src/routes/hotels.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,21 @@ import * as hotelController from '../controllers/hotel.contoller';
const mcheckUserLoggedIn = jest
.spyOn(auth, 'checkUserLoggedIn')
.mockImplementation((req, res, next) => {
req.user = 'john.doe'; //for testing bypassing the auth
//for testing bypassing the auth
req.user = {
username: 'john.doe',
connectedSocialAccounts: 0,
google: {
email: '',
profileId: '',
photoUrl: ''
},
github: {
email: '',
profileId: '',
photoUrl: ''
}
};
if (!req.user) {
return res.status(401).send({
error: 'You are not logged in..!!'
Expand Down
16 changes: 15 additions & 1 deletion src/routes/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,21 @@ import * as auth from '../services/auth.service';
const mcheckUserLoggedIn = jest
.spyOn(auth, 'checkUserLoggedIn')
.mockImplementation((req, res, next) => {
req.user = 'john.doe'; //for testing bypassing the auth
//for testing bypassing the auth
req.user = {
username: 'john.doe',
connectedSocialAccounts: 0,
google: {
email: '',
profileId: '',
photoUrl: ''
},
github: {
email: '',
profileId: '',
photoUrl: ''
}
};
if (req.user) {
next();
}
Expand Down

0 comments on commit 76d4165

Please sign in to comment.