Refactor TestGetListedTribes
To Use A Real Postgres DB For The Test
#1781
Labels
TestGetListedTribes
To Use A Real Postgres DB For The Test
#1781
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 thetest_config.go
configuration.After spinning up the Postgres DB container:
TestGetListedTribes
to connect to the Test DBThe test will throw a dereference error if not connected to a DB.
TestGetListedTribes
test cases e.g.mockDb.On("GetListedTribes", req).Return(expectedTribes)
.tHandler := NewTribeHandler(mockDb)
totHandler := NewTribeHandler(db.TestDb)
Unlisted: true
, and the other withUnlisted: false
using the db.TestDb.CreateOrEditTribe() function e.gUnlisted: false
are returned from the API requestAssertions
Acceptance Criteria
TestGetListedTribes
TestGetListedTribes
refactor passesTestGetListedTribes
should not break existing test flows.Here is an example Real DB Test
The text was updated successfully, but these errors were encountered: