new module:ct-services /testing /Request Stub(request Target)
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:ct-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:ct-services/testing/RequestStubEvents
).
fail()
Respond to the request with a failure. This will fire a FAILED event (defined in
module:ct-services/testing/RequestStubEvents
).
get Target() → {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