Communicate with a MockServer from any node or grunt build
MockServer allows you to mock any system you integrate with via HTTP or HTTPS (i.e. (REST) services, web sites, etc). Please note that it is a third party project that needs java.
This npm module allows any grunt or node project to easily communicate with a running MockServer instance.
As an addition to this module for communicating with a running MockServer there is a second project that can be used to start and stop a MockServer called mockserver-node.
The MockServer client can be created as follows:
var mockServer =mockServerClient = mockServermockServerClient // MockServer and proxy client
Note: this assumes you have an instance of MockServer running on port 1080. For more information on how to do so check mockserver-node.
A simple expectation can be set up as follows:
A more complex expectation can be set up like this:
For the full documentation see MockServer - Creating Expectations.
It is also possible to verify that request were made:
It is furthermore possible to verify that sequences of requests were made in a specific order:
For the full documentation see MockServer - Verifying Requests.
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.
All notable and significant changes are detailed in the MockServer changelog
Task submitted by James D Bloom