-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge back from production and Bump rc version
- Loading branch information
Showing
6 changed files
with
128 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { S3Storage, S3TimeoutError } from '../S3Storage'; | ||
|
||
let s3Storage: S3Storage; | ||
|
||
class S3TimeoutClient { | ||
// eslint-disable-next-line class-methods-use-this | ||
send() { | ||
const error = new Error(); | ||
error.name = 'TimeoutError'; | ||
throw error; | ||
} | ||
} | ||
|
||
describe('s3Storage', () => { | ||
beforeAll(async () => { | ||
// @ts-ignore | ||
s3Storage = new S3Storage(new S3TimeoutClient()); | ||
}); | ||
|
||
describe('get', () => { | ||
it('should throw S3TimeoutError on timeout', async () => { | ||
await expect(s3Storage.get('dummy_key')).rejects.toBeInstanceOf(S3TimeoutError); | ||
}); | ||
}); | ||
|
||
describe('upload', () => { | ||
it('should throw S3TimeoutError on timeout', async () => { | ||
await expect( | ||
s3Storage.upload('dummy_key', Buffer.from('dummy buffer', 'utf-8')) | ||
).rejects.toBeInstanceOf(S3TimeoutError); | ||
}); | ||
}); | ||
|
||
describe('delete', () => { | ||
it('should throw S3TimeoutError on timeout', async () => { | ||
await expect(s3Storage.delete('dummy_key')).rejects.toBeInstanceOf(S3TimeoutError); | ||
}); | ||
}); | ||
|
||
describe('list', () => { | ||
it('should throw S3TimeoutError on timeout', async () => { | ||
await expect(s3Storage.list()).rejects.toBeInstanceOf(S3TimeoutError); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters