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

Update model tests to use before block #1545

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Beckyrose200
Copy link
Contributor

DEFRA/water-abstraction-team#128

This PR is part of our ongoing work to make unit tests faster, more efficient and less flakey, focusing on the model unit tests.

We are simplifying the database seeding process by moving it to a top-level before block instead of using beforeEach. Since the model unit tests check the relationships between table models, putting all the test data in one place means we only need to seed the database once instead of before each test. By seeding less data into the test database, our hope is that the tests run faster, the code is cleaner, and they are less flakey due to conflicting test data.

DEFRA/water-abstraction-team#128

This PR is part of our ongoing work to make unit tests faster, more efficient and less flakey, focusing on the model unit tests.

We are simplifying the database seeding process by moving it to a top-level before block instead of using beforeEach. Since the model unit tests check the relationships between table models, putting all the test data in one place means we only need to seed the database once instead of before each test. By seeding less data into the test database, our hope is that the tests run faster, the code is cleaner, and they are less flakey due to conflicting test data.
@Beckyrose200 Beckyrose200 added the housekeeping Refactoring, tidying up or other work which supports the project label Dec 10, 2024
@Beckyrose200 Beckyrose200 self-assigned this Dec 10, 2024
@Beckyrose200 Beckyrose200 marked this pull request as ready for review December 10, 2024 11:13
@Beckyrose200 Beckyrose200 marked this pull request as draft December 10, 2024 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
housekeeping Refactoring, tidying up or other work which supports the project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant