praxis-app / praxis-ui

Deprecated project for standalone client.
GNU General Public License v3.0
9 stars 3 forks source link

Unit test for ProposalForm #19

Open forrestwilkins opened 1 year ago

forrestwilkins commented 1 year ago

The ProposalForm component needs full test coverage, as it's critical for the site to serve it's main purpose.

The following libraries should be enough in order to get 100% coverage:

Some of the above may not be necessary and there might also be better options available.

Here's a unit test from the old project for reference:

AmyNicole8715 commented 1 year ago

May I try this? I haven't done testing on JS, only on Ruby but I know I need to learn it and I could potentially do this but if it is time sensitive I may have time but not a lot.

forrestwilkins commented 1 year ago

@AmyNicole8715 For sure! This isn't time sensitive at all and you can take as long as you need on it. Just as a heads up, the testing environment hasn't been set up yet, and @RobertJIreland and I are currently working on that. So whether or not you want to wait until after it's setup is up to you, but it should be a little easier after that.

We're most likely going with Jest and RTL. Here are some of our main reference points so far:

RobertJIreland commented 1 year ago

@AmyNicole8715 So far I was trying to use babel to compile the code for testing, however ran into an issue with crypto-random-string (node_moudule). If I try to ignore that module (I.e transformIgnorePatterns) I hit an error about class private methods not being enabled even though this plugin now comes included in the babel/preset-env. I tried downloading the plugin '@babel/plugin-proposal-methods' and got the original error about crypto-random-string.