© Marcos Iglesias 2019
M. IglesiasPro D3.jshttps://doi.org/10.1007/978-1-4842-5203-1_9

9. Testing Your Charts

Marcos Iglesias1 
(1)
San Francisco, CA, USA
 

In Chapters 3 and 4, we saw some D3.js code encapsulation strategies and chose an abstraction: the Reusable API. Later in Chapter 5, we saw how to transform standard D3.js code into production-ready Reusable API components. However, to produce a real professional chart, we need to supply unit tests to the component.

In this chapter, we follow the steps to redo our example bar chart in a Test-Driven Development (TDD) way, achieving a professional chart with ample test coverage. We’ll cover the creation of unit tests for Reusable API components and go over the process of preparing a simple development ...

Get Pro D3.js: Use D3.js to Create Maintainable, Modular, and Testable Charts 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.