lngyeen / MySurveyChallenge

0 stars 0 forks source link

[Question] Decision to do integration test between Repository and NetworkAPIClient instead of unit testing Repository #35

Closed blyscuit closed 4 months ago

blyscuit commented 4 months ago

Issue

Repository unit tests are dependent on NetworkAPIClient, what lead you to write test this way? How would you do differently if you were to test repository as a unit test? Which is you preferred method of testing the repository?

lngyeen commented 4 months ago

@blyscuit I already fixed in this PR ;) Basically, I have separated one more layer (DataProviders), this layer is between Repository and NetworkAPIClient. This layer is responsible for composing request config and sending it to NetworkAPIClient, and also specifies the data type returned to NetworkAPIClient. I also created a NetworkAPIClientMock manually so I can test the DataProviders. https://github.com/lngyeen/MySurveyChallenge/pull/41