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

[Task]: Organize tests to be easier to read / spread across a few more files #1524

Closed
1 task
chouinar opened this issue Mar 22, 2024 · 0 comments · Fixed by #1561
Closed
1 task

[Task]: Organize tests to be easier to read / spread across a few more files #1524

chouinar opened this issue Mar 22, 2024 · 0 comments · Fixed by #1561
Assignees
Labels
project: grants.gov Grants.gov Modernization tickets

Comments

@chouinar
Copy link
Collaborator

Summary

Some of our tests, especially https://github.com/HHS/simpler-grants-gov/blob/main/api/tests/src/api/opportunities_v0_1/test_opportunity_route.py - are long. This is good that we have a lot of tests, but can be difficult to read through / know where to update it. We should take a bit of time to clean up these tests and split them across files / organize into a more readable format.

Acceptance criteria

  • Tests are easier to read / parse / know how to update
@chouinar chouinar added the project: grants.gov Grants.gov Modernization tickets label Mar 22, 2024
@chouinar chouinar added this to the Search API - API development milestone Mar 22, 2024
@chouinar chouinar self-assigned this Mar 26, 2024
chouinar added a commit that referenced this issue Apr 1, 2024
## Summary
Fixes #1524

### Time to review: __3 mins__

## Changes proposed
Restructured the tests for the v0.1 opportunity endpoint

Split the search and get endpoints into their own files

## Context for reviewers
I did not add or remove any tests, just adjusted how they were organized
to hopefully be easier to parse.

The setup for a few tests was altered to use a more consistent pattern /
reuse existing utility methods. This adjustment did result in some tests
running faster (due to less teardown/recreation of data between tests).

Unfortunately, search has a lot of scenarios that need to be tested, so
there is only so much that can be done to minimize the length of that
file. I could split the search tests across several files (each of the
class

## Additional information
To confirm I didn't accidentally add/delete any tests, the output from
running `make test` before and after:

BEFORE:
![Screenshot 2024-03-27 at 11 46 53
AM](https://github.com/HHS/simpler-grants-gov/assets/46358556/5826fa02-72a5-4b30-bdcd-431fc457e3a5)

AFTER:
![Screenshot 2024-03-27 at 11 46 34
AM](https://github.com/HHS/simpler-grants-gov/assets/46358556/c072850c-c7c3-41eb-8b5a-c00564e47af3)

After is slightly faster due to adjusting the test setup to be less
repetitive for a few tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
project: grants.gov Grants.gov Modernization tickets
Projects
Development

Successfully merging a pull request may close this issue.

1 participant