Mocha dot helpers
A set of helpers for mocha test suite.
Valuable
Takes a function executes it before each test an returns a function that returns the value returned by the original function. If given function returns a promise then it returns the value returned by the promise.
It is specially useful for async value handling since it helps you work in a more sync way. Of course it is only useful for tests and most not be used in other contexts.
Example 1:
const Promise = ; const createObjectAsync = { return Promise;}; const d = ;const object = d; ;
Example 2:
const Promise = ; const createUserAsync = { //Go to db, create an user and return a promise for it}; const doSomethingAsyncWithUseruser // This function expects an user instance (not a promise) // does something with the user and returns a promise for // the result} const d = ;const user = d;const result = d; ;
Install
npm install mocha-dot-helpers
Test
npm test
License
MIT