Skip to content

How to create a mock response

Lloyd Brookes edited this page Jul 9, 2017 · 14 revisions

If you need a server-side resource or service which doesn't yet exist or is out of reach, the goal of mocks is to enable you to quickly create one.

If you have lws-mock-response present in your stack (included by default) you will have the option to set --mocks.

$ ws --mocks my-mocks-module.js

The very minimum mock module, you can use this as a boilerplate template. Replace MyMockModule with a more useful name.

module.exports = MockBase => class MyMockModule extends MockBase {
  mocks () {
  }
}
Clone this wiki locally