Maintainable Tests while maintaining Sanity
summary
Concrete recipe for getting broken specs green: configure TestBed from zero to hero by declaring the component, mocking dependencies in providers, and mocking child components instead of using NO_ERRORS_SCHEMA is an anti-pattern. Use ng-mocks (mockProvider/mockDeclaration), overrideComponent to replace component-scoped providers, and use rxjs.empty for observable properties. Workflow aims for an 80/20/10 split—80% happy path fixes, 20% harder overrides, 10% design changes for long-term testability.
AI-written summary · about
chapters (9)
- 0:00Introduction
- 2:06About me
- 7:44Emergency
- 9:57Mocking
- 11:35Problems
- 13:32General advice
- 15:11Empty as mock
- 17:31Antipattern
- 19:22Resources
related talks
19mModern Testing Strategies for Reactive Applications
24mIf the world is burning to the ground - keep calm and write a test for it
13mTesting Angular Components Fundamentals
29mFall in LOVE with Unit Testing
21mTest Kitchen: A Recipe for Good Tests
48mTesting Should Be Fun
52mAngular Testing: Do I Really Have to Do It?!
25mWriting Testable Code
