Skip to content

Commit 4a58f6b

Browse files
committed
remove some mock s3 clients
1 parent f4fcda6 commit 4a58f6b

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

spec/test.spec.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ describe('S3Adapter tests', () => {
2020

2121
expect(() => {
2222
new S3Adapter('accessKey', 'secretKey', {});
23-
}).toThrow(new Error('Failed to configure S3Adapter with invalid arguments.'));
23+
}).toThrow(new Error("Failed to configure S3Adapter. Arguments don't make sense"));
2424

2525
expect(() => {
2626
new S3Adapter({ accessKey: 'accessKey', secretKey: 'secretKey' });
@@ -628,14 +628,15 @@ describe('S3Adapter tests', () => {
628628
let options, s3ClientMock;
629629
beforeEach(() => {
630630
options = {
631+
bucket: 'bucket-1',
631632
bucketPrefix: 'test/',
632633
};
633634
s3ClientMock = jasmine.createSpyObj('S3Client', ['send']);
634635
s3ClientMock.send.and.returnValue(Promise.resolve());
635636
});
636637

637638
it('should save a file with right command', async () => {
638-
const s3 = getMockS3Adapter(options);
639+
const s3 = new S3Adapter(options);
639640
s3._s3Client = s3ClientMock;
640641

641642
await s3.createFile('file.txt', 'hello world', 'text/utf8', {});
@@ -645,7 +646,7 @@ describe('S3Adapter tests', () => {
645646
});
646647

647648
it('should save a file with metadata added', async () => {
648-
const s3 = getMockS3Adapter(options);
649+
const s3 = new S3Adapter(options);
649650
s3._s3Client = s3ClientMock;
650651
const metadata = { foo: 'bar' };
651652

@@ -659,7 +660,7 @@ describe('S3Adapter tests', () => {
659660
});
660661

661662
it('should save a file with tags added', async () => {
662-
const s3 = getMockS3Adapter(options);
663+
const s3 = new S3Adapter(options);
663664
s3._s3Client = s3ClientMock;
664665
const tags = { foo: 'bar', baz: 'bin' };
665666

@@ -674,7 +675,7 @@ describe('S3Adapter tests', () => {
674675

675676
it('should save a file with proper ACL with direct access', async () => {
676677
options.directAccess = true;
677-
const s3 = getMockS3Adapter(options);
678+
const s3 = new S3Adapter(options);
678679
s3._s3Client = s3ClientMock;
679680

680681
await s3.createFile('file.txt', 'hello world', 'text/utf8', {});
@@ -687,7 +688,7 @@ describe('S3Adapter tests', () => {
687688
});
688689

689690
it('should save a file with proper ACL without direct access', async () => {
690-
const s3 = getMockS3Adapter(options);
691+
const s3 = new S3Adapter(options);
691692
s3._s3Client = s3ClientMock;
692693

693694
await s3.createFile('file.txt', 'hello world', 'text/utf8', {});
@@ -702,7 +703,7 @@ describe('S3Adapter tests', () => {
702703
it('should save a file and override ACL with direct access', async () => {
703704
options.directAccess = true;
704705
options.fileAcl = 'private';
705-
const s3 = getMockS3Adapter(options);
706+
const s3 = new S3Adapter(options);
706707
s3._s3Client = s3ClientMock;
707708

708709
await s3.createFile('file.txt', 'hello world', 'text/utf8', {});
@@ -718,7 +719,7 @@ describe('S3Adapter tests', () => {
718719
// Create adapter
719720
options.directAccess = true;
720721
options.fileAcl = 'none';
721-
const s3 = getMockS3Adapter(options);
722+
const s3 = new S3Adapter(options);
722723
s3._s3Client = s3ClientMock;
723724

724725
await s3.createFile('file.txt', 'hello world', 'text/utf8', {});

0 commit comments

Comments
 (0)