Continue the Design

We covered the happy path for the readTickersFile function, but along the way we added two tests to the test list to handle cases where the file may be empty or contain data in an invalid format. We’ll take care of those scenarios next.

Negative Tests for readTickersFile

At this stage of the design, the readTickersFile function calls parseTickers to parse the content of the file into an array of ticker symbols. If the file were empty, then the content would also be empty. In that case this helper function should return an empty array—let’s jot down a test in the test list to ensure that behavior of parseTickers is handled when we come around to design that function. That begs the question, what if the content, instead of being ...

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.