Testing behaviors - BDD with Mocha

We really will not do this BDD-style because we have very little space left in the book and writing about automated testing to any significant degree can fill way more pages than we really have left. We will update our typescriptSankey function to filter by a particular relationship when the user clicks on a node; however, do so in a BDD fashion, which should hopefully give you a taste of how all this works. Just remember that testing is generally best when you write your tests before you write any other code!

To start, create a new file in lib/chapter9, called index.spec.js. The convention is to name your test file the same as the file it's testing, but with .spec before the file extension. Before we write ...

Get D3.js 4.x Data Visualization - Third Edition 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.