~/talk

Mocks, Spies, and Timers - Oh My!

Talkat EmberCamp Chicago 2019 · on Monday, 2019-09-16· [testing]
github:eshtadc
slides:none on file

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

  1. 0:00Intro
  2. 1:14Unit Tests
  3. 2:08Container Tests
  4. 3:59Rendering Tests
  5. 5:32Application Tests
  6. 7:57System Under Test
  7. 9:32SinonJS: Stubs
  8. 15:06SinonJS: Mocks
  9. 16:56SinonJS: Timers
  10. 20:00Usage: SinonJS
  11. 21:35TestDouble.js td
  12. 25:41Mocking makes refactoring harder
  13. 26:16Mocking is a Code Smell
  14. 26:45Mocking violates DRY
  15. 27:15Don't mock what you don't own
  16. 28:32Don't strive for 100% coverage
  17. 29:17Test behavior, not implementation
  18. 29:27Thank you!
~/search
type to search 8,222 conferences, 162,397 speakers and 219,688 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
← →
on a talk: 5 seconds back / forward
0–9
on a talk: jump to 0%–90% of the recording
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.