codu-code / codu

Codú's open-source codebase. A space for coders. Visit our community!
https://codu.co/
Apache License 2.0
141 stars 145 forks source link

Unit testing the codebase #467

Open NiallJoeMaher opened 1 year ago

NiallJoeMaher commented 1 year ago

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 😢

kera-cudmore commented 1 year ago

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

NiallJoeMaher commented 1 year ago

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

DarrachBarneveld commented 1 year ago

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

xiaoniuniu89 commented 1 year ago

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

xiaoniuniu89 commented 1 year ago

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

NiallJoeMaher commented 1 year ago

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?

xiaoniuniu89 commented 1 year ago

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 commented 1 year ago

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

John-Paul-Larkin commented 1 year ago

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?

NiallJoeMaher commented 1 year ago

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! 📈

John-Paul-Larkin commented 1 year ago

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.

ghost commented 1 year ago

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