Isolating Dependencies with Test Doubles with TypeScript & Jest
Discover the pivotal role of test doubles in modern software testing. This introductory session will guide you through the essentials of dummies, stubs, spies, mocks, and fakes. Learn how these powerful tools help you isolate units under test, control behavior, and build reliable, fast, and maintainable tests. Step into the world of test doubles and elevate your software development skills.
Lessons and practices
Testing Email Parameters with Dummies
Enhancing the Logger Interface
Fix the Test Suite Bug
Implementing Dummies in Test Suites
Master Dummies in Test Suites
Stubbing for Weather Alerts
Handle freezing conditions with Stubbed data
Handling stormy conditions
Stubbing Out Lovely Weather
Refactor!
Spying on Method Calls
Spying on Urgent Notifications
Spying on Medium Priority Notifications
Spying on Multiple Method Calls
Mock Pricing Service for Testing
Verifying Dependencies Aren't Called using Mocks
Expect Exceptions for Negative Prices
Mocking Multiple Calls with Mock Implementations
Calculating Bulk Prices
Using a Fake User Repository
Expect an Exception When Adding Duplicate Users
Update a Registered User
Handle when Updating Non-Existent Users
Deactivating Users
Expect Exception when Deactivating Non-Existent Users
Interested in this course? Learn and practice with Cosmo!
Practice is how you turn knowledge into actual skills.