Function taking Command input and returning result
Sets a function that will be called on any Client#send()
invocation.
Can be chained so that successive invocations call different functions. When there are no more
callsFakeOnce()
functions to use, invocations will call a function specified by callsFake()
.
clientMock
.callsFakeOnce(cmd => 'first call')
.callsFakeOnce(cmd => 'second call')
.callsFake(cmd => 'default');
Function taking Command input and returning result
Allows specifying the behavior for a given Command type and its input (parameters).
If the input is not specified, it will match any Command of that type.
Command type to match
Optional
input: Partial<TCmdInput>Command payload to match
Optional
strict: booleanShould the payload match strictly (default false, will match if all defined payload properties match)
Allows specifying the behavior for any Command with given input (parameters).
If the input is not specified, the given behavior will be used for any Command with any input.
Calling onAnyCommand()
without parameters is not required to specify the default behavior for any Command,
but can be used for readability.
clientMock.onAnyCommand().resolves(123)
is same as:
clientMock.resolves(123)
Optional
input: Partial<TCmdInput>Command payload to match
Optional
strict: booleanShould the payload match strictly (default false, will match if all defined payload properties match)
Sets a failure response that will be returned from any Client#send()
invocation.
The response will always be an Error
instance.
Optional
error: string | Error | AwsErrorError text, Error instance or Error parameters to be returned
Sets a failure response that will be returned from one Client#send()
invocation.
The response will always be an Error
instance.
Can be chained so that successive invocations return different responses. When there are no more
rejectsOnce()
responses to use, invocations will return a response specified by rejects()
.
clientMock
.rejectsOnce('first call')
.rejectsOnce('second call')
.rejects('default');
Optional
error: string | Error | AwsErrorError text, Error instance or Error parameters to be returned
Sets a successful response that will be returned from any Client#send()
invocation.
Content to be returned
Sets a successful response that will be returned from one Client#send()
invocation.
Can be chained so that successive invocations return different responses. When there are no more
resolvesOnce()
responses to use, invocations will return a response specified by resolves()
.
clientMock
.resolvesOnce('first call')
.resolvesOnce('second call')
.resolves('default');
Content to be returned
Generated using TypeDoc
Sets a function that will be called on any
Client#send()
invocation.