stakwork / sphinx-tribes

Backend for sphinx tribes and bounties. The bounty platform pays out in bitcoin. Sign up with Sphinx Chat, complete a bounty, and earn bitcoin! Go to our website for available bounties.
https://community.sphinx.chat/bounties
33 stars 60 forks source link

Refactor `TestGetListedTribes` To Use A Real Postgres DB For The Test #1781

Closed elraphty closed 3 months ago

elraphty commented 4 months ago

Context

Currently, we test the TestGetListedTribes with a mock database.

Design

We want to refactor the tests to use a real Postgres DB spun up on docker, follow the instructions in the Unit Testing section of README.md to run spin up a database in docker, and change the test_config.go configuration.

After spinning up the Postgres DB container:

db.TestDb.CreateOrEditTribe(tribe) db.TestDb.CreateOrEditTribe(tribe2)


- Assert that only tribes with `Unlisted: false` are returned from the API request

### Assertions

- [ ] Assert that all the test passes

### Acceptance Criteria

- [ ] Do not delete any of the existing test cases on the `TestGetListedTribes`
- [ ] All test cases after the `TestGetListedTribes` refactor passes 
- [ ] The Refactoring of `TestGetListedTribes` should not break existing test flows.
- [ ] I have rebased and tested locally before submitting my PR
- [ ] I can submit a PR within 1 day of taking the bounty

Here is an [example Real DB Test](https://github.com/stakwork/sphinx-tribes/blob/e7419f99eff616a5a2ee4daefa12c2a5e5dde930/handlers/bounty_test.go#L455C1-L488C1)
AhsanFarooqDev commented 4 months ago

@elraphty please assign

AbdulWahab3181 commented 4 months ago

@elraphty Could you please assign me?

MuhammadUmer44 commented 4 months ago

@elraphty assign me

MirzaHanan commented 4 months ago

@elraphty PLease assign me?

aliraza556 commented 4 months ago

@elraphty Assign me next one?

AbdulWahab3181 commented 4 months ago

@elraphty Could you please assign me the next issue?