This course is not up to current Frontend Masters standards, but it still shows some relevant lessons on what makes code difficult to test. We now recommend you take the JavaScript Testing Practices and Principles course.

Check out a free preview of the full The Psychology of Code Testability course:
The "Testing Classes and Business Logic" Lesson is part of the full, The Psychology of Code Testability course featured in this preview video. Here's what you'd learn in this lesson:

How do you test a class? You test it by replacing the class’s sub-dependencies with ‘friendly’ dummy modules. Then everything that goes wrong is in the class under test. The real sub-dependencies can be plugged back in later. Keep business-logic separate from object graph construction and lookup. Mixing these two types of coding makes testing hard. It’s easier to replace real modules with friendly modules.

Get Unlimited Access Now