jetpack icon indicating copy to clipboard operation
jetpack copied to clipboard

Would Jetpack be interested in more unit tests and more specific unit tests?

Open enkrates opened this issue 12 years ago • 4 comments

I've noticed that there seem to be some opportunities for the Jetpack unit tests to be fleshed out. I haven't been through all the code yet, but it seems that in general there is a bunch of Jetpack code for which there is no corresponding unit test. In some cases, especially when a method pulls in a WP global variable, it might be complicated to write a useful test case. However, in other cases, it seems like a class is very lightly tested. For example, in the test_get_url_returns_string_on_valid_input test the only check done is to see if the return value is a string, but we know that the function should return one of three specific strings, each of which should be easily testable (no globals, no database access, etc). Did Jetpack explicitly decide to loosely couple this test, or would it be useful to have a few more tests that confirm that this method works as designed?

enkrates avatar Aug 07 '14 15:08 enkrates

There are indeed opportunities for more unit tests, so do not hesitate to submit Pull Requests with new tests and mention this issue. We'll be happy to review your tests and add them to Jetpack. More tests is always a good thing!

jeherve avatar Aug 07 '14 15:08 jeherve

^^ what he said. Any new unit tests are gladly and gratefully accepted.

georgestephanis avatar Aug 07 '14 16:08 georgestephanis

That's great news. I am writing up a few tests right now to get some low hanging fruit and I am going to see what other simple methods I can write tests for to lock down their return values.

enkrates avatar Aug 07 '14 16:08 enkrates

I'm closing this issue as there has been progress on specific pulls and the questions has been answered. Feel free to reopen or continue commenting if it's needed. :)

georgestephanis avatar Oct 09 '14 18:10 georgestephanis