My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more

Separation of Concerns and Unit Testing

Ben Goosman's photo
Ben Goosman
·Mar 24, 2020

Keeping related code together and unrelated code in other classes makes writing unit tests much easier. This is called SoC, or Separation of Concerns. By following SoC, one has more opportunity to mock class dependencies and simply verify the right functions are called, trusting that the dependency has its own unit tests.