3.2 Spies and Retrospective Testing
This final episode is two fold. First we look at mocking out a method that hits a 3rd party API. Using Jasmine’s spying functionality we can hijack calls to the method and return sample JSON, to save our tests hitting the external API. Secondly, we look at a case when an eager colleague has written code without tests, and techniques to retrospectively fit tests to implementation code.