microdotblog / microblog-react

MIT License
29 stars 3 forks source link

Add unit tests #78

Closed paulrobertlloyd closed 2 months ago

paulrobertlloyd commented 2 months ago

There are currently no unit tests. Besides ensuring the app remains bug free and that new changes don’t introduce bugs, these would also be useful to help contributors debug issues (especially if unable to get the app running locally) and understand how the app works.

vincentritter commented 2 months ago

Thanks for this. Right now unit tests aren't planned. I think it would make it a little less fun to work on (personally), but you are more than welcome to contribute tests in a PR if you'd like to see them.

I might revisit this in future.

manton commented 2 months ago

I also think unit tests are often not worth it, but the one area that could have automated testing of value is the client API calls. Just something that ran through Micropub, XML-RPC, and other calls.

paulrobertlloyd commented 2 months ago

Given the issues experienced by a number of users around third-party APIs, and the many and varied ways these often work and varying implementations, I agree @manton, this is definitely an area that would benefit from having some degree of test coverage, I think.

I know that I’ve benefitted enormously from having tests, with so many potential bugs prevented. And, once a framework is in place, in most cases can be fairly easy to set up. When it comes to mocking things it can get tricky, and it can be quite easy to end up writing tests whose only purpose is to pass, not actually improve the end product. That said, some tests are 100% better than no tests.

If I can get the project working locally, I might have a go at adding some tests around the Micropub API.