Topics in intermediate/early-advaned Jasmine testing for client-side JavaScript web applications.
Source code, test specs, and harnesses available here:
https://github.com/jbellsey/dbc-jasmine
3. SPIES
Objectives
Isolation
Control
Prevent method under observation
from invoking helpers (expensive,
side-effect-prone)
Ensure those helpers are actually
being called properly
Tracking
Replace operations with simulations
to test how our method responds
10. TIMERS
What about
requestAnimationFrame?
Velocity.js $.Velocity.mock = true;
Greensock TimelineLite.timeScale()
Some testing support is best
provided outside of Jasmine
12. AJAX
Most of the time…
YOU DON’T.
Angular.js => angular-mocks
jQuery => mockJax
Backbone => backbone-faux-server
Use library mocks
Integration tests Karma
Selenium
PhantomJS
But once in a while…