Learn how to mock Express response (and request) objects for unit testing in TypeScript.
0:00 - Start
3:08 - First problem - bad mock type
3:18 - Type Assertion - solution for bad types
4:36 - Second problem - missing mock function
4:50 - Solution for missing json function
5:35 - Incorrect type assertion
5:41 - Solution for the incorrect type assertion: Partial
6:41 - Green test result
Udemy profile: https://www.udemy.com/user/david-csejtei/
LinkedIn profile: https://www.linkedin.com/in/davidcsejtei/
Medium profile: https://codinglikedavid.medium.com/
π Join my slack group to get help: https://join.slack.com/t/codinglikedavid/shared_invite/zt-wowi9q4g-0N_ngfSx0dcOUMaRftdylQ
Download
0 formats
No download links available.
How to mock (Express) Response in tests - Node.js - TypeScript | NatokHD