From 4c6cd4f7dfe88eefe02bc8dea2db5987c3772ef0 Mon Sep 17 00:00:00 2001 From: blam Date: Thu, 24 Mar 2022 10:20:20 +0100 Subject: [PATCH] chore: mocks don't work if they're deconstructed? Signed-off-by: blam --- .../backend-common/src/reading/AwsS3UrlReader.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/backend-common/src/reading/AwsS3UrlReader.ts b/packages/backend-common/src/reading/AwsS3UrlReader.ts index 7c314cf036..5d471dfae7 100644 --- a/packages/backend-common/src/reading/AwsS3UrlReader.ts +++ b/packages/backend-common/src/reading/AwsS3UrlReader.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import aws, { Credentials, S3 } from 'aws-sdk'; +import aws from 'aws-sdk'; import { CredentialsOptions } from 'aws-sdk/lib/credentials'; import { ReaderFactory, @@ -126,7 +126,7 @@ export class AwsS3UrlReader implements UrlReader { return integrations.awsS3.list().map(integration => { const credentials = AwsS3UrlReader.buildCredentials(integration); - const s3 = new S3({ + const s3 = new aws.S3({ apiVersion: '2006-03-01', credentials, endpoint: integration.config.endpoint, @@ -145,7 +145,7 @@ export class AwsS3UrlReader implements UrlReader { constructor( private readonly integration: AwsS3Integration, private readonly deps: { - s3: S3; + s3: aws.S3; treeResponseFactory: ReadTreeResponseFactory; }, ) {} @@ -156,17 +156,17 @@ export class AwsS3UrlReader implements UrlReader { */ private static buildCredentials( integration?: AwsS3Integration, - ): Credentials | CredentialsOptions | undefined { + ): aws.Credentials | CredentialsOptions | undefined { if (!integration) { return undefined; } const accessKeyId = integration.config.accessKeyId; const secretAccessKey = integration.config.secretAccessKey; - let explicitCredentials: Credentials | undefined; + let explicitCredentials: aws.Credentials | undefined; if (accessKeyId && secretAccessKey) { - explicitCredentials = new Credentials({ + explicitCredentials = new aws.Credentials({ accessKeyId, secretAccessKey, });