Download attachments in separate queue from message processing

This commit is contained in:
Scott Nonnenberg 2019-01-30 12:15:07 -08:00
parent a43a78731a
commit 1d2c3ae23c
34 changed files with 2062 additions and 214 deletions

View file

@ -575,17 +575,22 @@ describe('Message', () => {
body: 'hey there!',
quote: {
text: 'hey!',
attachments: [],
attachments: [
{
fileName: 'manifesto.txt',
contentType: 'text/plain',
},
],
},
};
const result = await upgradeVersion(message, { logger });
assert.deepEqual(result, message);
});
it('eliminates thumbnails with no data field', async () => {
it('does not eliminate thumbnails with missing data field', async () => {
const upgradeAttachment = sinon
.stub()
.throws(new Error("Shouldn't be called"));
.returns({ fileName: 'processed!' });
const upgradeVersion = Message._mapQuotedAttachments(upgradeAttachment);
const message = {
@ -597,7 +602,7 @@ describe('Message', () => {
fileName: 'cat.gif',
contentType: 'image/gif',
thumbnail: {
fileName: 'failed to download!',
fileName: 'not yet downloaded!',
},
},
],
@ -611,6 +616,9 @@ describe('Message', () => {
{
contentType: 'image/gif',
fileName: 'cat.gif',
thumbnail: {
fileName: 'processed!',
},
},
],
},