DEV Community

Discussion on: Can I Get Some Feedback? (Moment.js in particular)

Collapse
 
dmfay profile image
Dian Fay

Check out Mocha's in-browser test harness. It has you set up a page which pulls in the test framework Mocha and Chai (a library of assertions like equal, isTrue, lengthOf, and so on). You'll need to put your logic in a function so you can invoke it from your testcases as well as the "real" call sites, and ideally it should produce easily verifiable outputs, decoupling it from the display code; or alternatively you could look into mocking libraries like Sinon.