internetarchive / iare

An interactive IARI JSON viewer
GNU Affero General Public License v3.0
5 stars 4 forks source link

Setup initial unit testing framework #39

Closed vbanos closed 1 year ago

vbanos commented 1 year ago

Create a sample unit test for FilterButton. The general idea is that you load a component with some params, you render it in a virtual screen and then you check the values of its attributes and/or the presence of specific text.

Add jsdom dependency.

Move dev dependencies to devDependencies in package.json.

Modify npm run test script to run the tests.

vbanos commented 1 year ago

I haven't used @testing-library/react before. We used enzyme but it is deprecated in React 18 so I couldn't use it. This setup may not be optimal but it works.