O'Reilly logo

Developing a D3.js Edge by Chris Viau, Andrew Thornton, Ger Hobbelt, Roland Dunn

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

5. Unit Testing / Test Suites

  • Build a test suite using the Jasmine BDD framework
  • Test the bar chart plugin developed in previous chapters

Building Testable Code

Implementing the reusable API will help with building testable code. We will assume you already know what Test-Driven Development (TDD) is, or at least what is a unit test. TDD forces you to write modular units, that are totally decoupled from other modules, where the logic is usually hidden behind a clean API. Using a test suite framework or a simple assert function, you write down the contract (the way to use your module from the public API), in a way that is meaningful and readable ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required