Skip to content

05 Endpoint Imposter

Łukasz Makuch edited this page Jul 14, 2022 · 2 revisions

Endpoint Imposter provides declarative yet stateful API mocks.

This very distribution of tools doesn't perform many custom operations. It's more of a glue among the tested app, the tests themselves and the mocks.

With frontend testing tools you don't have to worry about starting the mocked server. It'll start and stop automatically when you run your tests.

With frontend testing tools you don't have to manually prefix mocks so that they don't colide. Simply place a rest.js file next to your test.js file and the mocks exported by it will be prefixed automatically.

With frontend testing tools you don't have to install endpoint-imposter-utils yourself. They are installed for you and exposed through one of the built-in modules (ei).

All you have to do, after you set up your app to be testable, is to:

  1. Create a rest.js file that exports some mocks like module.exports = [{request, response}]
  2. Link your app to the mocked server like that: .setupStart().eiUse().setupFinish()

Everything else is just regular Endpoint Imposter stuff which you can learn more about from the official documentation of Endpoint Imposter

Clone this wiki locally