Test Interactions
Weâve tested and implemented the createURL and setLocation functions. That leaves three more functions to be tested and implemented from our modular design diagram. Letâs pick the locate function next as that will help us explore a technique weâve not seen so far in this bookâtesting interactions.
The tests weâve written so far are all empirical tests. You call a method and assert that it returned a desired resultâsynchronously or asynchronously. When working with dependencies, often itâs hard to predict the results. For example, if code depends on a service that returns the current temperature in Chicago, itâs hard to write an empirical test for that code. Interaction tests are better for code with dependencies. ...
Get Test-Driving JavaScript Applications now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.