Closed azubieta closed 5 years ago
You can also use a mock object, but the code in here, even if it's "just error handling", needs testing IMO.
You can also create another issue and postpone that discussion. Let's rather move on.
Too late, already added the mock AppImage
I was talking about a mock object, not a mock AppImage. The idea was to test that unit test code, so it should be possible to test this code against a mock object or simply a desktop entry object with broken code. That should be possible in a good software architecture. Adding more and more bloaty AppImages for testing is a bad idea.
I see, I thought you were talking about a whole AppImage. As I said XdgUtils
already test the scenario where the desktop file is malformed. This code only renames
the exception. We definitively add a redundant test on the DesktopEntry
parsing.
You depict this wrong. There is 5-10 lines of code in this library that you say doesn't have to be tested. It does have to be tested. It's code in here. That's not redundant, it's checking that your "renaming" or whatever works. Doesn't matter if it interacts with another library. As said, there's an option of mocking said library and triggering the the exception block that way, no need to use that library. For each such situation there should be a unit test to validate this behavior. But there are no unit tests at all in this project anyway...
This exception is thrown by the
XdgUtils
lib and it's already checked there. Adding another check onlibappimage
will require us to add a yet another broken AppImage file to the repository.