chat-e2ee icon indicating copy to clipboard operation
chat-e2ee copied to clipboard

Write UT for SocketInstance in chat-e2ee/service module

Open muke1908 opened this issue 2 years ago • 6 comments

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

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

muke1908 avatar Jul 07 '23 11:07 muke1908

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

sharduld1908 avatar Jul 23 '23 15:07 sharduld1908

@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?

sharduld1908 avatar Jul 29 '23 02:07 sharduld1908

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

muke1908 avatar Jul 31 '23 09:07 muke1908

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

sharduld1908 avatar Aug 03 '23 03:08 sharduld1908

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

muke1908 avatar Aug 03 '23 07:08 muke1908