BioDrop icon indicating copy to clipboard operation
BioDrop copied to clipboard

[FEATURE] Add test for map page to populate location information on local environment

Open weilincheng opened this issue 3 years ago • 11 comments

Description

In the current implementation, user location information in MongoDB is only updated when a user visits their profile page. As a result, when running the project in local development mode, no user has location data in the database, preventing user markers from appearing on the map page. Currently, developers must manually visit multiple user profiles to populate the database with location information.

To improve the development experience, we have discussed this situation in issue #5473, which will add an explanation to the Map Information Doc. @naomi-lgbt suggested adding a seed script that can populate the database with mock user location data. Running this script locally would make it easier to test the map functionality without having to visit multiple user profiles.

I suggest adding the seed script to the services/profiles directory and naming it seedLocationData.js. This script could generate random location data for a specified number of users and insert it into the database. We can then add the usage instructions to the Map Information Doc.

I believe that this feature would be beneficial for both experienced and beginner developers, and I look forward to your feedback.

Screenshots

No response

Additional information

No response

weilincheng avatar Apr 01 '23 06:04 weilincheng

It's great having you contribute to this project

Welcome to the community :nerd_face:

If you would like to continue contributing to open source and would like to do it with an awesome inclusive community, you should join our Discord chat and our GitHub Organisation - we help and encourage each other to contribute to open source little and often 🤓 . Any questions let us know.

github-actions[bot] avatar Apr 01 '23 06:04 github-actions[bot]

Yes, @weilincheng I agree with you. I face this same issue all the time. This feature will help developers a lot.

joe-shajan avatar Apr 01 '23 10:04 joe-shajan

I don't think a seed script is needed. Another solution which is also good practice is if they run the automated tests, some profiles will be visited and this will also populate the database with a location

eddiejaoude avatar Apr 02 '23 01:04 eddiejaoude

I don't think a seed script is needed. Another solution which is also good practice is if they run the automated tests, some profiles will be visited and this will also populate the database with a location

Hi Eddie, thank you for your comment. That's a great point about using the automated tests to populate the database with location data. I’ll give it a try and see how it works.

weilincheng avatar Apr 02 '23 09:04 weilincheng

Great, thanks 👍

eddiejaoude avatar Apr 02 '23 09:04 eddiejaoude

I have assigned this to you @weilincheng as we have been discussing it in the docs PR about write a test file to visit some profile pages https://github.com/EddieHubCommunity/LinkFree/pull/5766

Let me know if that is ok, or if you prefer me to unassigned it

eddiejaoude avatar Apr 03 '23 03:04 eddiejaoude

I have assigned this to you @weilincheng as we have been discussing it in the docs PR about write a test file to visit some profile pages #5766

Let me know if that is ok, or if you prefer me to unassigned it

Thank you for assigning this issue to me, Eddie. I appreciate it. As we have been discussing this issue in #5766, I will work on it and keep you updated. Thank you again for your support.

weilincheng avatar Apr 03 '23 09:04 weilincheng

Another solution which is also good practice is if they run the automated tests, some profiles will be visited and this will also populate the database with a location

This suggests that our tests aren't encapsulated. A test suite, IMHO, should not leave a database polluted.

naomi-lgbt avatar Apr 04 '23 15:04 naomi-lgbt

Another solution which is also good practice is if they run the automated tests, some profiles will be visited and this will also populate the database with a location

This suggests that our tests aren't encapsulated. A test suite, IMHO, should not leave a database polluted.

Hi Naomi. I agree with your concern about test encapsulation and the importance of not leaving the database polluted. Maybe we can address it by using a separate database for testing to prevent any potential pollution of the production database. Let me know if you have any suggestions or best practices you'd like to share, and we can discuss them further to improve our test suite. 😃

weilincheng avatar Apr 15 '23 05:04 weilincheng

No one has access to the production database (even me), so there is a low risk of it affecting production.

I think as the direction of this issue has changed, can the title be updated @weilincheng ? thanks

eddiejaoude avatar Apr 15 '23 05:04 eddiejaoude

I think as the direction of this issue has changed, can the title be updated @weilincheng ? thanks

Thank you for pointing that out. I've updated the issue title accordingly. Please let me know if there are any further improvements or suggestions.

weilincheng avatar Apr 15 '23 06:04 weilincheng