Document Message v4, remove data-free thumbnails
This commit is contained in:
parent
6599535cbb
commit
bf81c3db63
2 changed files with 43 additions and 3 deletions
|
@ -410,6 +410,37 @@ describe('Message', () => {
|
|||
assert.deepEqual(result, message);
|
||||
});
|
||||
|
||||
it('eliminates thumbnails with no data fielkd', async () => {
|
||||
const upgradeAttachment = sinon.stub().throws(new Error("Shouldn't be called"));
|
||||
const upgradeVersion = Message._mapQuotedAttachments(upgradeAttachment);
|
||||
|
||||
const message = {
|
||||
body: 'hey there!',
|
||||
quote: {
|
||||
text: 'hey!',
|
||||
attachments: [{
|
||||
fileName: 'cat.gif',
|
||||
contentType: 'image/gif',
|
||||
thumbnail: {
|
||||
fileName: 'failed to download!',
|
||||
},
|
||||
}],
|
||||
},
|
||||
};
|
||||
const expected = {
|
||||
body: 'hey there!',
|
||||
quote: {
|
||||
text: 'hey!',
|
||||
attachments: [{
|
||||
contentType: 'image/gif',
|
||||
fileName: 'cat.gif',
|
||||
}],
|
||||
},
|
||||
};
|
||||
const result = await upgradeVersion(message);
|
||||
assert.deepEqual(result, expected);
|
||||
});
|
||||
|
||||
it('calls provided async function for each quoted attachment', async () => {
|
||||
const upgradeAttachment = sinon.stub().resolves({
|
||||
path: '/new/path/on/disk',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue