-
-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Branch Name
feature/49-test-database
Task
At the moment we are currently using our actual database to do our testings which isn't a good practice, so let's fix that. We will implement our test database using Docker. That way, we can have isolated testing.
We don't have to containerize the entire project. We just need our test database that can be cleaned, reset and reseeded with the empty data table design each time we run our tests. We should be able to start our docker container and create a .env.test with appropriate information such as DATABASE_URL that will be pointing locally to the docker container. We must create tables before we run our tests too (obviously). After testing, we should be able reset it by tearing down the container.
Steps:
- Create a docker file for the repo that will set up the test database
- Seed the test database (create a seed.sql with information regarding our columns and tables! you can find all of them either on Supabase themselves with "Copy Table Schema" or on this Notion doc (https://www.notion.so/h4i/Final-Database-Table-Queries-15-Total-Last-Updated-9-28-2025-247197abf07b80d2819bc105a4b8df8d) In this case, just create the tables and you don't need to insert any actual data.
Basic commands:
- docker compose up -d <== set up docker container for test db
- npm run seed:test <== to seed data
- npm run test <== run our tests
- docker compose down -v <== tear down container after testing's over
root directory/
docker-compose.yml
db-init/
seed.sql
Acceptance Criteria
- Set up a Docker container
- Create a .test.env for test db env info
- Create a .sql to seed data
- Successful creation of test db (creating test db, successful run of 'npm run test', tear down docker container, repeating the cycle...)
Checklist
- I have checked for duplicate issues.
- I have assigned the issue to the correct project board.
- I have tagged the issue properly.
Code of Conduct
- I agree to follow this project's Code of Conduct
Metadata
Metadata
Assignees
Labels
Type
Projects
Status