Support for server-configurable maximum attachment size
This commit is contained in:
parent
677548f3a3
commit
37c44fb631
6 changed files with 23 additions and 38 deletions
|
@ -13,31 +13,6 @@ import { fakeAttachment } from '../../test-both/helpers/fakeAttachment';
|
|||
import { DAY } from '../../util/durations';
|
||||
|
||||
describe('Attachment', () => {
|
||||
describe('getUploadSizeLimitKb', () => {
|
||||
const { getUploadSizeLimitKb } = Attachment;
|
||||
|
||||
it('returns 6000 kilobytes for supported non-GIF images', () => {
|
||||
assert.strictEqual(getUploadSizeLimitKb(MIME.IMAGE_JPEG), 6000);
|
||||
assert.strictEqual(getUploadSizeLimitKb(MIME.IMAGE_PNG), 6000);
|
||||
assert.strictEqual(getUploadSizeLimitKb(MIME.IMAGE_WEBP), 6000);
|
||||
});
|
||||
|
||||
it('returns 25000 kilobytes for GIFs', () => {
|
||||
assert.strictEqual(getUploadSizeLimitKb(MIME.IMAGE_GIF), 25000);
|
||||
});
|
||||
|
||||
it('returns 100000 for other file types', () => {
|
||||
assert.strictEqual(getUploadSizeLimitKb(MIME.APPLICATION_JSON), 100000);
|
||||
assert.strictEqual(getUploadSizeLimitKb(MIME.AUDIO_AAC), 100000);
|
||||
assert.strictEqual(getUploadSizeLimitKb(MIME.AUDIO_MP3), 100000);
|
||||
assert.strictEqual(getUploadSizeLimitKb(MIME.VIDEO_MP4), 100000);
|
||||
assert.strictEqual(
|
||||
getUploadSizeLimitKb('image/vnd.adobe.photoshop' as MIME.MIMEType),
|
||||
100000
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('getFileExtension', () => {
|
||||
it('should return file extension from content type', () => {
|
||||
const input: Attachment.AttachmentType = fakeAttachment({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue