Mocking in Front-end and Back-end TypeScript Tests
summary
A simple game app with a Redis-backed leaderboard gets unit, integration and e2e tests that mock only what’s needed: import-level functions and Express request/response objects while leaving Vue components mountable. Uses ts-auto-mock to fill Partial<T> objects and ts-mock-imports to replace module imports, runs tests with Jest and Cypress, and fakes Redis in unit runs. Test run shows 8 server tests, 19 unit component tests and 6 end-to-end tests all passing.
AI-written summary · about
chapters (5)
related talks
57mScaling the Testing Pyramid in JavaScript
38mHow to Stop Hating Tests with Jest, Supertest and Cypress
25mAngular + Jest: Testing Titbits
31mNext Level Jest Testing
30mTips, Tricks, and Best Practices
45mCross-Framework Testing in MFs
30mVue Router, Hoisting Mocks and Unit Test Spaghetti
19mModern Testing Strategies for Reactive Applications
