Skip to content

Commit

Permalink
fix socketmock
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasHub committed Dec 31, 2024
1 parent 5fedbe9 commit 181f970
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions backend/src/controllers/tests/1-clients.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { ObjectID } from 'mongodb'
import { IClient } from '../../models/clients'
import { Jwt } from '../../models/technical'
import { saveClient } from '../clients';
import MockedSocket from 'socket.io-mock';
import SocketMock from 'socket.io-mock';

const fakeUser: Jwt = {
data: {
Expand Down Expand Up @@ -45,7 +45,7 @@ describe('clients controller :: saveClient creation', () => {
user: fakeUser,
body: {...fakeClient, name: 'Company X'},
db: fakeDb,
io: new MockedSocket(),
io: new SocketMock(),
} as ConfacRequest;

const res = {
Expand Down
4 changes: 2 additions & 2 deletions 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';
import SocketMock from 'socket.io-mock';

const fakeUser: Jwt = {
data: { _id: '_id', email: 'string', firstName: 'first', name: 'name', alias: 'alias', active: true },
Expand All @@ -30,7 +30,7 @@ const createFakeRequestAndResponse = (db: Db, consultant: Partial<IConsultant> |
user: fakeUser,
body: {...fakeConsultant, ...(consultant || {})},
db,
io: new MockedSocket(),
io: new SocketMock(),
} as ConfacRequest;

const res = {
Expand Down
4 changes: 2 additions & 2 deletions backend/src/controllers/tests/3-projectsMonth.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +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';
import SocketMock from 'socket.io-mock';



Expand All @@ -22,7 +22,7 @@ const app = express();
app.use(bodyParser.json());
app.use((req: Request, res: Response, next: NextFunction) => {
req.db = getFakeDb();
req.io = new MockedSocket();
req.io = new SocketMock();
next();
});
app.use('/', projectsRouter);
Expand Down
4 changes: 2 additions & 2 deletions backend/src/controllers/tests/4-projectsMonth.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +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';
import SocketMock from 'socket.io-mock';



Expand All @@ -21,7 +21,7 @@ const app = express();
app.use(bodyParser.json());
app.use((req: Request, res: Response, next: NextFunction) => {
req.db = getFakeDb();
req.io = new MockedSocket();
req.io = new SocketMock();
next();
});
app.use('/', projectsRouter);
Expand Down

0 comments on commit 181f970

Please sign in to comment.