texas-justice-initiative / website-nextjs

The website for Texas Justice Initiative
https://texasjusticeinitiative.org
GNU General Public License v2.0
7 stars 3 forks source link

Automated tests? #89

Open nholden opened 5 years ago

nholden commented 5 years ago

As we continue to add features to the site, I'd be more confident in our work if we had automated tests to ensure we're not introducing regressions.

I don't think we need 100% coverage immediately, but it would be great if we could identify some critical functionality and write some simple tests. For me, the first thing that comes to mind is how we manipulate data on the "Explore the Data" page. If we introduce a bug that results in data being displayed incorrectly in charts or CSV downloads, it could lead to inaccurate reporting and would damage TJI's reputation.

Since we ran eslint --fix in https://github.com/texas-justice-initiative/website-nextjs/pull/69, a quick win would be to run some linting so that we can automatically detect style issues and prevent nitpicking in pull request reviews.

I'm pretty biased here, but I'd love to see what it would look like to run automated functionality tests and linting via GitHub Actions, which is free for public repositories and wouldn't require us to sign up for a separate service. Jest seems to be the current winner for testing JavaScript, and React recommends React Testing Library if we want to test components at some point (and there's an example of how that would look on a Next.js app).

Curious to hear what you think, @LayaTaal, @judan, @haywood, et. al.!

LayaTaal commented 5 years ago

Hey @nholden , I think this is a really great idea. I have never written tests like this myself, but it is something I would love to learn. If you are interested, perhaps this is something you could spearhead after we launch the new site, or alternatively, it may be a great project for some student interns or other volunteers in the future. What do you think?

laconc commented 5 years ago

Love this! Seems like Github Actions would be ideal.

nholden commented 5 years ago

Glad to hear there's an appetite for testing!

If you are interested, perhaps this is something you could spearhead after we launch the new site, or alternatively, it may be a great project for some student interns or other volunteers in the future. What do you think?

Sure, I'd be happy to help us get started and/or help student interns or other volunteers take on. I have a lot of experience writing tests on Ruby projects, so I know some general patterns that have worked well for me and pitfalls to avoid, but I haven't done as much JS testing, so I have a bunch to learn here, too.