Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
muke1908 opened this issue Jul 7, 2023 · 5 comments
Open

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

muke1908 opened this issue Jul 7, 2023 · 5 comments
Assignees
Labels
easy small Pull request is small unit-test

Comments

@muke1908
Copy link
Owner

muke1908 commented Jul 7, 2023

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

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

@muke1908 muke1908 added easy small Pull request is small unit-test labels Jul 7, 2023
@sharduld1908
Copy link

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

@sharduld1908
Copy link

@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
Copy link
Owner Author

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

@sharduld1908
Copy link

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

@muke1908
Copy link
Owner Author

muke1908 commented Aug 3, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
easy small Pull request is small unit-test
Projects
None yet
Development

No branches or pull requests

2 participants