ConstAssert that a command was received at least once.
The AWS client stub
The command constructor to check for
Matcher result
Assert that a command was received exactly N times.
The AWS client stub
The command constructor to check for
The exact number of times the command should have been received
Matcher result
Assert that a command was received with specific input parameters.
The AWS client stub
The command constructor to check for
The expected input parameters
Matcher result
Assert that the Nth command call was a specific command with specific input.
n counts calls across ALL commands of the client; use
toHaveReceivedNthCommandOfTypeWith to count per command type.
The AWS client stub
The call number (1-indexed)
The command constructor to check for
The expected input parameters
Matcher result
const s3Mock = mockClient(S3Client);
const client = new S3Client({});
await client.send(new PutObjectCommand({ Bucket: 'test', Key: 'file1.txt' }));
await client.send(new GetObjectCommand({ Bucket: 'test', Key: 'file2.txt' }));
expect(s3Mock).toHaveReceivedNthCommandWith(2, GetObjectCommand, {
Bucket: 'test',
Key: 'file2.txt'
});
Assert that the Nth call of one specific command type had the given input.
Unlike toHaveReceivedNthCommandWith, n counts only calls of command
(as in aws-sdk-client-mock-vitest).
The AWS client stub
The call number among calls of command (1-indexed)
The command constructor to check for
The expected input parameters
Matcher result
Assert that a command was received exactly once.
Assert that a command was received exactly once, with the given input.
Assert that the last call of a command type had the given input.
Assert that no commands other than the expected ones were received.
The AWS client stub
Array of command constructors that are allowed
Matcher result
Custom Vitest matchers for asserting AWS SDK command calls.