After decoupling it should be possible to unit test functionality. Try [QUnit](https://qunitjs.com/), PlayCanvas uses it: [example](https://github.com/playcanvas/engine/blob/master/tests/math/test_curve.js)
After decoupling it should be possible to unit test functionality. Try QUnit, PlayCanvas uses it: example