Skip to content

Commit

Permalink
revert: fix uploader spec
Browse files Browse the repository at this point in the history
  • Loading branch information
bobalazek committed May 28, 2024
1 parent 0a2e98c commit 3b0e6a8
Showing 1 changed file with 7 additions and 41 deletions.
48 changes: 7 additions & 41 deletions packages/uploader/src/Uploader.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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),
};
});

Expand All @@ -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 () => {
Expand All @@ -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 () => {
Expand All @@ -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 () => {
Expand All @@ -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 () => {
Expand All @@ -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 () => {
Expand All @@ -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');
});
});
});

0 comments on commit 3b0e6a8

Please sign in to comment.