-
Notifications
You must be signed in to change notification settings - Fork 44
Open
Description
I've been upgrading an code base to use the latest AWS-SDK packages, I have the following snippet of code that I am trying to test (that used to work on the older packages)
const uploader = new Upload({
client: this.s3Client,
params: {
Bucket: destinationBucket,
Key: destinationKey,
Body: sourceObject.Body,
},
partSize: 5242880 * 4, // 20MB
});
await uploader.done();
in the test I have configured the following mock
const mockS3 = mockClient(S3Client);
mockS3
.on(GetObjectCommand, { Key: key, Bucket: bucket })
.resolves({ Body: sdkStreamMixin(ReadableStream.from('x'.repeat(30e6))) });
// note: there is more mocking but I removed that for brevity as this was the minimum I needed to repeat the issue
when I run the above code it fails with this error
TypeError: Cannot read properties of undefined (reading 'requestChecksumCalculation')
I also tried defining the mock like this
const s3Client = new S3Client({ requestChecksumCalculation: 'WHEN_REQUIRED' });
const mockS3 = mockClient(s3Client);
but the same TypeError
Is there a way to define a mock of a client with specific config to get past this?
Metadata
Metadata
Assignees
Labels
No labels