Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

node.js: Mock http request and response

Is there convenient way to mock the HTTP Request and Response objects for unit testing middlewares?

like image 763
7elephant Avatar asked Nov 05 '11 17:11

7elephant


1 Answers

It looks like both https://github.com/howardabrams/node-mocks-http and https://github.com/vojtajina/node-mocks can be used to create mock http.ServerRequest and http.ServerResponse objects.

like image 169
mjs Avatar answered Sep 24 '22 06:09

mjs