~/talk

Mock & Roll

Talkat EmberFest 2021 · 2021-09-30..10-01· [testing, developer-experience]
slides:none on file

Practical guide to Sinon.js applied to Ember: defines dummies fakes spies stubs mocks, shows concrete code stubbing window.fetch to resolve with JSON and simulating failures, spying on window.alert to assert arguments, and using a Sinon sandbox (or ember-sinon-qunit) to auto-restore between tests. Demonstrates two ways to stub a shopping-cart service and why stubbing the real service class prevents API drift. Advises to stub only what’s needed, restore sandboxes to avoid leaks and flakiness, and use fakes/mocks for multi-method interactions.

AI-written summary · about

  1. 0:00Introduction and background
  2. 1:05What are test doubles
  3. 4:56Why stubbing and mocking matter
  4. 6:39Benefits of unit tests
  5. 7:00Test doubles in Sinon.js
  6. 10:31Sinon.js sandbox setup
  7. 11:38Testing a service with stubs
  8. 14:23Testing routes with spies
  9. 15:27Testing controllers and state machines
  10. 17:52Avoiding API drift in tests
  11. 18:55Integration testing components
  12. 20:39Application tests and fakes
  13. 21:22Best practices for stubs and mocks
  14. 23:07Invest in unit tests
  15. 24:30Sinon.js features and conclusion
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 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
?
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.