mockagent
A mocking utility for superagent in the browser. If you are using Node.js shmock is recommended.
Usage
var superagent = ;var mockagent = ; mockagenttargetsuperagent; // Make a simply static mockmockagent; superagent// ... // For more complex mocks, use a function to create the response.// This function is bound to the superagent Request instance, making// it possible to check headers, request body, etc.mockagent; // To tear down the mockmockagent;
Mockagent can take a single URL to mock, or an array of URLs. The response can be given as an object, or a string. If it is given as an object, it will be serialized to a JSON string before being returned.
Development
Pull it down
$ git clone https://github.com/kahnjw/mockagent.git$ cd mockagent
Test it
$ npm test
Make pulls against the github repository.
Happy testing!