Caplin Trader 4.8.0

Class: module:caplin/services/testing/RequestStub

module:caplin/services/testing/RequestStub

Constructor

new module:caplin/services/testing/RequestStub(requestTarget)

Used by service stubs to represent an asynchronous request. These will typically be passed with any events that the stub fires, and can then be used by tests/workbenches to see what has been requested, and to provide a response. This class uses emitr, and raises events defined in module:caplin/services/testing/RequestStubEvents.
Parameters:
Name Type Description
requestTarget Object The target of the request.

Methods

acknowledge()

Respond to the request with a success. This will fire an ACKNOWLEDGED event (defined in module:caplin/services/testing/RequestStubEvents).

fail()

Respond to the request with a failure. This will fire a FAILED event (defined in module:caplin/services/testing/RequestStubEvents).

getTarget() → {Object}

Returns:
The target of the request is that which the requested operation should be performed on. For example, if the request is to dismiss a notification, then the notification would be the target. The action itself should be defined by the event raised by the service stub.
Type
Object