Integrate and Run

We need one final function that integrates all the functions together and for that, we need a few integration tests. Let’s start with the integration tests; you can also key these into the stockfetch-test.js file:

​ it(​'getPriceForTickers should report error for invalid file'​,
​  ​function​(done) {
​  ​var​ onError = ​function​(error) {
​  expect(error).to.be.eql(​'Error reading file: InvalidFile'​);
​  done();
​  };
​  ​var​ display = ​function​() {};
​ 
​  stockfetch.getPriceForTickers(​'InvalidFile'​, display, onError);
​ });
​ 
​ it(​'getPriceForTickers should respond well for a valid file'​,
​  ​function​(done) {
​  ​var​ onError = sandbox.mock().never(); ...

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.