muke1908 / chat-e2ee

End-to-end encrypted disposable chat & audio-call sessions, exchange sensitive information with peer safely and securely.
https://chat-e2ee-2.azurewebsites.net/
Apache License 2.0
345 stars 203 forks source link

Write UT for SocketInstance in chat-e2ee/service module #311

Open muke1908 opened 1 year ago

muke1908 commented 1 year ago

Mock 'socket.io-client' library and write unit test.

https://github.com/muke1908/chat-e2ee/blob/master/service/src/socket/socket.ts

sharduld1908 commented 1 year ago

Can you assign me this issue? Would like to contribute to this project.

sharduld1908 commented 1 year ago

@muke1908 I am facing this error when I run 'npm run dev' { [1] err: MongoAPIError: URI must include hostname, domain name, and tld [1] at resolveSRVRecord (/home/sharduld/open_source/node_projects/chat-e2ee/node_modules/mongodb/src/connection_string.ts:65:11) [1] at /home/sharduld/open_source/node_projects/chat-e2ee/node_modules/mongodb/src/mongo_client.ts:457:45 [1] at maybeCallback (/home/sharduld/open_source/node_projects/chat-e2ee/node_modules/mongodb/src/utils.ts:449:19) [1] at MongoClient.connect (/home/sharduld/open_source/node_projects/chat-e2ee/node_modules/mongodb/src/mongo_client.ts:449:25) [1] at /home/sharduld/open_source/node_projects/chat-e2ee/backend/db/index.ts:17:18 [1] at Generator.next () [1] at /home/sharduld/open_source/node_projects/chat-e2ee/backend/db/index.ts:8:71 [1] at new Promise () [1] at __awaiter (/home/sharduld/open_source/node_projects/chat-e2ee/backend/db/index.ts:4:12) [1] at Object.connectDb (/home/sharduld/open_source/node_projects/chat-e2ee/backend/db/index.ts:14:45) { [1] [Symbol(errorLabels)]: Set(0) {} [1] } [1] } [1] MONGO DB ERROR! Using in-memory DB - Not reliable!!

I have already set up the .env according to the .env.sample in the repo. Not sure why the database is not connecting. Can you help me here?

muke1908 commented 1 year ago

@Shardul1908 probably wrong URI (wrong format)? You should still be able to run the app even if no mongo db.

sharduld1908 commented 1 year ago

Ohh okay, let me try that. Why is MongoDB used then?

muke1908 commented 1 year ago

If mongodb is not configured, it'll use inMem storage. Not ideal but you'll be able to run the app. Mongodb is configured in production