Export long message attachments
This commit is contained in:
parent
a9406a7914
commit
511fc9c1a0
20 changed files with 423 additions and 82 deletions
|
@ -692,4 +692,34 @@ describe('Message', () => {
|
|||
assert.deepEqual(result, expected);
|
||||
});
|
||||
});
|
||||
describe('migrateBodyAttachmentToDisk', () => {
|
||||
it('writes long text attachment to disk, but does not truncate body', async () => {
|
||||
const message = getDefaultMessage({
|
||||
body: 'a'.repeat(3000),
|
||||
});
|
||||
const expected = getDefaultMessage({
|
||||
body: 'a'.repeat(3000),
|
||||
bodyAttachment: {
|
||||
contentType: MIME.LONG_MESSAGE,
|
||||
...FAKE_LOCAL_ATTACHMENT,
|
||||
},
|
||||
});
|
||||
const result = await Message.migrateBodyAttachmentToDisk(
|
||||
message,
|
||||
getDefaultContext()
|
||||
);
|
||||
assert.deepEqual(result, expected);
|
||||
});
|
||||
it('does nothing if body is not too long', async () => {
|
||||
const message = getDefaultMessage({
|
||||
body: 'a'.repeat(2048),
|
||||
});
|
||||
|
||||
const result = await Message.migrateBodyAttachmentToDisk(
|
||||
message,
|
||||
getDefaultContext()
|
||||
);
|
||||
assert.deepEqual(result, message);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue