From 3b0e6a81c9915bb455ad1cdb34c2954a22a33a02 Mon Sep 17 00:00:00 2001 From: Borut Balazek Date: Tue, 28 May 2024 09:08:28 +0200 Subject: [PATCH] revert: fix uploader spec --- packages/uploader/src/Uploader.spec.ts | 48 ++++---------------------- 1 file changed, 7 insertions(+), 41 deletions(-) diff --git a/packages/uploader/src/Uploader.spec.ts b/packages/uploader/src/Uploader.spec.ts index 86d6df22..eee8c199 100644 --- a/packages/uploader/src/Uploader.spec.ts +++ b/packages/uploader/src/Uploader.spec.ts @@ -6,11 +6,7 @@ import { uploader } from './Uploader'; vitest.mock('@aws-sdk/client-s3', () => { return { - S3Client: vitest.fn().mockImplementation(() => { - return { - send: vitest.fn().mockResolvedValue({}), - }; - }), + S3Client: vitest.fn().mockImplementation(() => void 0), }; }); @@ -33,12 +29,7 @@ describe('Uploader.ts', () => { forcePathStyle: true, }); - expect(result).toEqual({ - client: expect.objectContaining({ - send: expect.any(Function), - }), - bucket: 'bucket', - }); + expect(result.bucket).toEqual('bucket'); }); it('should set forcePathStyle to false for non-local URL', async () => { @@ -54,12 +45,7 @@ describe('Uploader.ts', () => { forcePathStyle: false, }); - expect(result).toEqual({ - client: expect.objectContaining({ - send: expect.any(Function), - }), - bucket: 'bucket', - }); + expect(result.bucket).toEqual('bucket'); }); it('should use the specified region from URL parameters', async () => { @@ -77,12 +63,7 @@ describe('Uploader.ts', () => { forcePathStyle: false, }); - expect(result).toEqual({ - client: expect.objectContaining({ - send: expect.any(Function), - }), - bucket: 'bucket', - }); + expect(result.bucket).toEqual('bucket'); }); it('should handle username and password in URL', async () => { @@ -98,12 +79,7 @@ describe('Uploader.ts', () => { forcePathStyle: true, }); - expect(result).toEqual({ - client: expect.objectContaining({ - send: expect.any(Function), - }), - bucket: 'bucket2', - }); + expect(result.bucket).toEqual('bucket2'); }); it('should handle different bucket names and regions', async () => { @@ -121,12 +97,7 @@ describe('Uploader.ts', () => { forcePathStyle: false, }); - expect(result).toEqual({ - client: expect.objectContaining({ - send: expect.any(Function), - }), - bucket: 'another-bucket', - }); + expect(result.bucket).toEqual('another-bucket'); }); it('should handle URLs with no username and password', async () => { @@ -142,12 +113,7 @@ describe('Uploader.ts', () => { forcePathStyle: false, }); - expect(result).toEqual({ - client: expect.objectContaining({ - send: expect.any(Function), - }), - bucket: 'test-bucket', - }); + expect(result.bucket).toEqual('test-bucket'); }); }); });