Mocks, Spies, and Timers - Oh My!
summary
Ember testing breaks into four concrete types — unit, container, rendering (component), and application — and this talk shows how to focus each test on its system under test instead of leaking dependencies. Practical patterns: spies record calls with Sinon, stubs replace implementations (useful for faking AJAX or ember-cli-mirage responses), fakes combine spy+stub behavior, and mocks assert upfront expectations. Fake timers let tests advance time instantly to avoid real waits; use the sandboxed Ember addons to auto-clean spies/stubs to prevent cross-test leaks.
AI-written summary · about
chapters (18)
- 0:00Intro
- 1:14Unit Tests
- 2:08Container Tests
- 3:59Rendering Tests
- 5:32Application Tests
- 7:57System Under Test
- 9:32SinonJS: Stubs
- 15:06SinonJS: Mocks
- 16:56SinonJS: Timers
- 20:00Usage: SinonJS
- 21:35TestDouble.js td
- 25:41Mocking makes refactoring harder
- 26:16Mocking is a Code Smell
- 26:45Mocking violates DRY
- 27:15Don't mock what you don't own
- 28:32Don't strive for 100% coverage
- 29:17Test behavior, not implementation
- 29:27Thank you!
