api.ex is just a bunch of defdelegates to Categories, Search, Users.
I want that developers use the library through the Api module. What would be the better way to write tests? I have now a good coverage for Categories, Search, Users and 0 tests for Api. Since it only delegates, then is there a point to duplicate the tests? Or maybe there is a way to check that delegation is setup correctly? Or since the Api module is intended to be used, then all tests should go there (but then it will get quite huge)?
Seems like your Api module is the higher-level user of those modules so you are likely looking for unit tests of the other modules and integration tests for Api – namely tests that utilise all functionalities covered by Api.
I don’t see a duplication. Just code integration tests and not unit tests that repeat what was already tested in the lower-level modules.
Then I misunderstood. I was left with the impression that Api actually does more by using all the lower-level modules. If that’s not true then I don’t think you should duplicate tests indeed, as you yourself said.