Test Utilities

fail()

Raises an AssertionError() with "Expected test to fail" as the error message.

make_im(opts)

Constructs an InteractionMachine(). Useful for testing things that a App() uses, for e.g. an http api helper for a particular app. All options are optional.

Arguments:
  • opts.app (App) – The app to be given to the interaction machine. If not given, a new app is created with a start state of ‘start’.
  • opts.api (object or DummyApi) – If an options object is given, a new DummyApi() is created using those options. Sensible defaults are provided for 'config' and 'kv' if those options are not given.
  • opts.msg (object) – The message to setup the InteractionMachine() with. Uses sensible defaults if not given.
  • opts.setup (boolean) – Whether InteractionMachine.setup() should be invoked. Defaults to true.
requester(api)

Returns a promise-based function that makes requests to the given api.

Arguments:
  • api (DummyApi) – The api to make requests to.