Skip to content

Commit

Permalink
socket mock rest of tests
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasHub committed Dec 31, 2024
1 parent 6e1d9fd commit 5fedbe9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion backend/src/controllers/tests/2-consultants.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { Jwt } from '../../models/technical'
import { saveConsultant } from '../consultants';
import { IConsultant } from '../../models/consultants';
import { MongoMemoryServer } from 'mongodb-memory-server';

import MockedSocket from 'socket.io-mock';

const fakeUser: Jwt = {
data: { _id: '_id', email: 'string', firstName: 'first', name: 'name', alias: 'alias', active: true },
Expand Down
4 changes: 3 additions & 1 deletion backend/src/controllers/tests/3-projectsMonth.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import request from 'supertest';
import express from 'express';
import projectsRouter from '../../routes/projects';
import bodyParser from 'body-parser';
import MockedSocket from 'socket.io-mock';



Expand All @@ -20,7 +21,8 @@ const getFakeDb: jest.Mock<Db> = jest.fn();
const app = express();
app.use(bodyParser.json());
app.use((req: Request, res: Response, next: NextFunction) => {
req.db = getFakeDb()
req.db = getFakeDb();
req.io = new MockedSocket();
next();
});
app.use('/', projectsRouter);
Expand Down
4 changes: 3 additions & 1 deletion backend/src/controllers/tests/4-projectsMonth.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import request from 'supertest';
import express from 'express';
import projectsRouter from '../../routes/projects';
import bodyParser from 'body-parser';
import MockedSocket from 'socket.io-mock';



Expand All @@ -19,7 +20,8 @@ const getFakeDb: jest.Mock<Db> = jest.fn();
const app = express();
app.use(bodyParser.json());
app.use((req: Request, res: Response, next: NextFunction) => {
req.db = getFakeDb()
req.db = getFakeDb();
req.io = new MockedSocket();
next();
});
app.use('/', projectsRouter);
Expand Down

0 comments on commit 5fedbe9

Please sign in to comment.