@@ -15,7 +15,9 @@ import { InternalServerError } from "../../src/common/errors/index.js";
1515// Note: We use vi.mock here instead of aws-sdk-client-mock because
1616// getSignedUrl is a standalone function, not an S3Client command
1717vi . mock ( "@aws-sdk/s3-request-presigner" , ( ) => ( {
18- getSignedUrl : vi . fn ( ) ,
18+ getSignedUrl : vi
19+ . fn ( )
20+ . mockResolvedValue ( "https://s3.amazonaws.com/bucket/key?signature=xyz" ) ,
1921} ) ) ;
2022
2123describe ( "S3 Presigned URL Functions" , ( ) => {
@@ -28,7 +30,7 @@ describe("S3 Presigned URL Functions", () => {
2830 const mockUrl = "https://s3.amazonaws.com/bucket/key?signature=xyz" ;
2931 const mockS3Client = new S3Client ( { region : "us-east-1" } ) ;
3032
31- vi . mocked ( getSignedUrl ) . mockResolvedValueOnce ( mockUrl ) ;
33+ vi . mocked ( getSignedUrl ) ;
3234
3335 const result = await createPresignedPut ( {
3436 s3client : mockS3Client ,
@@ -51,8 +53,6 @@ describe("S3 Presigned URL Functions", () => {
5153 const mockUrl = "https://s3.amazonaws.com/bucket/key?signature=abc" ;
5254 const mockS3Client = new S3Client ( { region : "us-east-1" } ) ;
5355
54- vi . mocked ( getSignedUrl ) . mockResolvedValueOnce ( mockUrl ) ;
55-
5656 const result = await createPresignedPut ( {
5757 s3client : mockS3Client ,
5858 bucketName : "test-bucket" ,
@@ -71,11 +71,9 @@ describe("S3 Presigned URL Functions", () => {
7171 } ) ;
7272
7373 test ( "creates a presigned PUT URL with MD5 hash" , async ( ) => {
74- const mockUrl = "https://s3.amazonaws.com/bucket/key?signature=def " ;
74+ const mockUrl = "https://s3.amazonaws.com/bucket/key?signature=xyz " ;
7575 const mockS3Client = new S3Client ( { region : "us-east-1" } ) ;
7676
77- vi . mocked ( getSignedUrl ) . mockResolvedValueOnce ( mockUrl ) ;
78-
7977 const result = await createPresignedPut ( {
8078 s3client : mockS3Client ,
8179 bucketName : "test-bucket" ,
0 commit comments