codu icon indicating copy to clipboard operation
codu copied to clipboard

Unit testing the codebase

Open NiallJoeMaher opened this issue 2 years ago • 12 comments

Context

Right now, we have no unit tests. We want the codebase to be tested.

The first thing would be some input on the appropriate testing.

Then once we have decided on some appropriate areas we can split the testing into issues to share the workload.

Expected Behavior

To get a coverage of 70% or higher of unit testing.

Current Behavior

No testing 😢

NiallJoeMaher avatar Oct 02 '23 13:10 NiallJoeMaher

Are you thinking of something like this?

https://blog.bitsrc.io/how-to-write-unit-tests-with-react-testing-library-in-the-next-js-5d22798afd9a

kera-cudmore avatar Oct 02 '23 16:10 kera-cudmore

Yes @kera-cudmore, that's what I was thinking. 🦾 Jest should already be working so it's just starting to starting to add tests.

NiallJoeMaher avatar Oct 02 '23 17:10 NiallJoeMaher

Would love to help once I see some initial tests written. I am very new to testing so would like to tackle simpler ones :)

DarrachBarneveld avatar Oct 03 '23 05:10 DarrachBarneveld

@NiallJoeMaher can we break this out into multiple stories, by page or something please? I can take the create page to start

xiaoniuniu89 avatar Oct 03 '23 20:10 xiaoniuniu89

Just saw that in the description:For unit tests RTL is good, it is a continuation of jest which isnt being maintained anymore

xiaoniuniu89 avatar Oct 03 '23 20:10 xiaoniuniu89

Yes @xiaoniuniu89 if anyone wants to take a crack at any part of the testing just make an issue and I can link it to here as a tasklist for a master issue.

And second I didn't know about Jest. Agreed on React Testing Library! I'm assuming that's what "RTL" means?

NiallJoeMaher avatar Oct 04 '23 19:10 NiallJoeMaher

im tempted to take this, and also set up eslint and something like husky to enforce some rules on pushing code ... but I will take the editor for now or I'll never get it done.

xiaoniuniu89 avatar Oct 04 '23 19:10 xiaoniuniu89

assign to me please. I want to add tests as part of next editor pr when it is done. We should do this first

xiaoniuniu89 avatar Oct 04 '23 21:10 xiaoniuniu89

Similar to Darraach, I dont know anthing about tests, so today is the day to learn. I have spent the morning reading about unit testing with jest and RTL. I have started to get a grasp of the implementation, but the reasoning behind testing is not clear to me just yet. In a few days I hope to get up to speed.

I see there are no tests as of yet and im just wondering if there is a plan? Should I just pick a component and go from there?

John-Paul-Larkin avatar Oct 15 '23 14:10 John-Paul-Larkin

Yes, if you want to get more green squares feel free to open an issue with the testing of a specific component and we can start working from there. Just makes sure nobody else is tackling it.

I'm going to unassign @xiaoniuniu89 so people know that they can get easy Hacktoberfest points by adding tests! 📈

NiallJoeMaher avatar Oct 15 '23 19:10 NiallJoeMaher

ok, I will open an issue and write a test for a component. If that is ok we can use it as a template to create issues for the other components.

John-Paul-Larkin avatar Oct 16 '23 08:10 John-Paul-Larkin

Hello!, Have been learning about testing and would love to get involved in this

ghost avatar Nov 09 '23 21:11 ghost