DataSource test coverage
jessesquires opened this issue · 4 comments
Two more cases need testing:
-
item(atRow row: Int, inSection section: Int) -> S.Item?
when section is invalid (verify returnnil
) -
remove(atRow row: Int, inSection section: Int) -> S.Item?
when (row, section) is invalid (verify returnnil
)
Hey @jessesquires , Do we need separate test for the item(atRow row: Int, inSection section: Int) -> S.Item?
? The remove(atRow row: Int, inSection section: Int) -> S.Item?
calls item(atRow row: Int, inSection section: Int) -> S.Item?
so I was thinking if I just test the remove(atRow row: Int, inSection section: Int) -> S.Item?
(with invalid section
/row
) then the item(atRow row: Int, inSection section: Int) -> S.Item?
will be tested indirectly ..🤔
Yes, you're correct -- however, I do think there's value in having an explicit, direct test for item(at...)
too.
With an explicit test, if it ever fails, it is very clear what went wrong. With an indirect test, we'd have to figure out "is remove(at..)
failing or something else?"
ok I see. I will update it. 👍🏻