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.
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 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.