mocks: docs, examples, tests

This commit is contained in:
Lloyd Brookes
2015-11-25 20:53:09 +00:00
parent 4150797b24
commit c0a72dbaf2
11 changed files with 338 additions and 58 deletions

View File

@ -148,11 +148,11 @@ function localWebServer (options) {
/* Mock Responses */
options.mocks.forEach(mock => {
if (mock.module) {
mock.targets = require(path.join(options.static.root, mock.module))
mock.responses = require(path.join(options.static.root, mock.module))
}
if (mock.targets) {
app.use(mw.mockResponses(mock.route, mock.targets))
if (mock.responses) {
app.use(mw.mockResponses(mock.route, mock.responses))
} else if (mock.response) {
mock.target = {
request: mock.request,