simulated
v1.0.5
Published
Mocking util for server side realtime async xhr io.
Downloads
4
Maintainers
Readme
simulated
This is supertest minus the assertions & expectations, used to simply mock API calls (when passed an express app instance) in an easier fashion than invoking the native express router. Big thanks to TJ.
simulated(app)
.get('/endpoint')
.end(function(err, response){
//
// i.e. use inside of socket.io connection,
// make call without frontend XHR
//
if (response.error.status === 404) {
socket.emit('news', response.error);
} else {
socket.emit('news', response.body);
}
});