i have javascript functionality reads values inputs on current page. these selected using custom attributes.
i want write tests prove working correctly using mocha
my question is, better route take
- create inputs on page shows mocha test results?
- try mock object act current page?
depends on code. of time use jquery data input fields. easier to create input fields in dom tests, cause not easy mock jquery in case. have mock $
first, must return object val
function.
you rewrite code function wanna test data parameter inject, instead of reading them input fields.
at end getting data dom same using new
operator in function wanna test or using global variables, should avoided better testability.
Comments
Post a Comment