From 8f7b6565a991fd084e5b12e10786a819755dec97 Mon Sep 17 00:00:00 2001 From: Nicolas Date: Tue, 31 Dec 2024 15:04:26 +0100 Subject: [PATCH] try import --- backend/package-lock.json | 10 +++------- backend/package.json | 2 +- backend/src/controllers/tests/1-clients.test.ts | 4 ++-- backend/src/controllers/tests/2-consultants.test.ts | 4 ++-- backend/src/controllers/tests/3-projectsMonth.test.ts | 4 ++-- backend/src/controllers/tests/4-projectsMonth.test.ts | 4 ++-- 6 files changed, 12 insertions(+), 16 deletions(-) diff --git a/backend/package-lock.json b/backend/package-lock.json index 5b553fb0..17a0ba3c 100644 --- a/backend/package-lock.json +++ b/backend/package-lock.json @@ -35,6 +35,7 @@ "regenerator-runtime": "^0.13.3", "slugify": "^1.1.0", "socket.io": "^4.8.1", + "socket.io-mock": "^1.3.2", "tmp": "^0.2.1", "ubl-builder": "github:pipesanta/ubl-builder", "uuid": "^10.0.0" @@ -84,7 +85,6 @@ "lint-staged": "^10.0.1", "mongodb-memory-server": "^8.12.1", "nodemon": "^1.11.0", - "socket.io-mock": "^1.3.2", "supertest": "^6.3.3", "ts-jest": "^29.0.5", "typescript": "4.3" @@ -6320,8 +6320,7 @@ "node_modules/component-emitter": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", - "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==", - "dev": true + "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==" }, "node_modules/concat-map": { "version": "0.0.1", @@ -16651,7 +16650,6 @@ "version": "1.3.2", "resolved": "https://registry.npmjs.org/socket.io-mock/-/socket.io-mock-1.3.2.tgz", "integrity": "sha512-p4MQBue3NAR8bXIHynRJxK/C+J3I3NpnnpgjptgLFSWv4u9Bdkubf2t0GCmyLmUTi03up0Cx/hQwzQfOpD187g==", - "dev": true, "license": "MIT", "dependencies": { "component-emitter": "^1.3.0" @@ -23835,8 +23833,7 @@ "component-emitter": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", - "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==", - "dev": true + "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==" }, "concat-map": { "version": "0.0.1", @@ -31842,7 +31839,6 @@ "version": "1.3.2", "resolved": "https://registry.npmjs.org/socket.io-mock/-/socket.io-mock-1.3.2.tgz", "integrity": "sha512-p4MQBue3NAR8bXIHynRJxK/C+J3I3NpnnpgjptgLFSWv4u9Bdkubf2t0GCmyLmUTi03up0Cx/hQwzQfOpD187g==", - "dev": true, "requires": { "component-emitter": "^1.3.0" } diff --git a/backend/package.json b/backend/package.json index c9c7f0cf..083ebde0 100644 --- a/backend/package.json +++ b/backend/package.json @@ -53,6 +53,7 @@ "regenerator-runtime": "^0.13.3", "slugify": "^1.1.0", "socket.io": "^4.8.1", + "socket.io-mock": "^1.3.2", "tmp": "^0.2.1", "ubl-builder": "github:pipesanta/ubl-builder", "uuid": "^10.0.0" @@ -102,7 +103,6 @@ "lint-staged": "^10.0.1", "mongodb-memory-server": "^8.12.1", "nodemon": "^1.11.0", - "socket.io-mock": "^1.3.2", "supertest": "^6.3.3", "ts-jest": "^29.0.5", "typescript": "4.3" diff --git a/backend/src/controllers/tests/1-clients.test.ts b/backend/src/controllers/tests/1-clients.test.ts index 9c801e16..e7351ab9 100644 --- a/backend/src/controllers/tests/1-clients.test.ts +++ b/backend/src/controllers/tests/1-clients.test.ts @@ -9,7 +9,7 @@ import { ObjectID } from 'mongodb' import { IClient } from '../../models/clients' import { Jwt } from '../../models/technical' import { saveClient } from '../clients'; -import SocketMock from 'socket.io-mock'; +import MockedSocket from 'socket.io-mock'; const fakeUser: Jwt = { data: { @@ -45,7 +45,7 @@ describe('clients controller :: saveClient creation', () => { user: fakeUser, body: {...fakeClient, name: 'Company X'}, db: fakeDb, - io: new SocketMock(), + io: new MockedSocket(), } as ConfacRequest; const res = { diff --git a/backend/src/controllers/tests/2-consultants.test.ts b/backend/src/controllers/tests/2-consultants.test.ts index 6412b069..cb662fc7 100644 --- a/backend/src/controllers/tests/2-consultants.test.ts +++ b/backend/src/controllers/tests/2-consultants.test.ts @@ -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 SocketMock from 'socket.io-mock'; +import MockedSocket from 'socket.io-mock'; const fakeUser: Jwt = { data: { _id: '_id', email: 'string', firstName: 'first', name: 'name', alias: 'alias', active: true }, @@ -30,7 +30,7 @@ const createFakeRequestAndResponse = (db: Db, consultant: Partial | user: fakeUser, body: {...fakeConsultant, ...(consultant || {})}, db, - io: new SocketMock(), + io: new MockedSocket(), } as ConfacRequest; const res = { diff --git a/backend/src/controllers/tests/3-projectsMonth.test.ts b/backend/src/controllers/tests/3-projectsMonth.test.ts index 9dd50f9a..8fbb1636 100644 --- a/backend/src/controllers/tests/3-projectsMonth.test.ts +++ b/backend/src/controllers/tests/3-projectsMonth.test.ts @@ -12,7 +12,7 @@ import request from 'supertest'; import express from 'express'; import projectsRouter from '../../routes/projects'; import bodyParser from 'body-parser'; -import SocketMock from 'socket.io-mock'; +import MockedSocket from 'socket.io-mock'; @@ -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 SocketMock(); + req.io = new MockedSocket(); next(); }); app.use('/', projectsRouter); diff --git a/backend/src/controllers/tests/4-projectsMonth.test.ts b/backend/src/controllers/tests/4-projectsMonth.test.ts index 04751801..fc44fc5d 100644 --- a/backend/src/controllers/tests/4-projectsMonth.test.ts +++ b/backend/src/controllers/tests/4-projectsMonth.test.ts @@ -11,7 +11,7 @@ import request from 'supertest'; import express from 'express'; import projectsRouter from '../../routes/projects'; import bodyParser from 'body-parser'; -import SocketMock from 'socket.io-mock'; +import MockedSocket from 'socket.io-mock'; @@ -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 SocketMock(); + req.io = new MockedSocket(); next(); }); app.use('/', projectsRouter);