In this chapter, we've explored how to test the requestAnimationFrame browser API. As you've no doubt found, it's not a straightforward process, and there are multiple tests that need to be written if you wish to be fully covered. What's more, we omitted testing the cancelAnimationFrame call, which is fine for demonstration purposes but probably not fine for a production app.
Despite the complication involved, it is possible to test animation, and the benefit of doing so is that the complex production code is fully documented via the tests.
In the next chapter, we'll look at how acceptance testing can help add an even greater level of verification and documentation to your system.