Link Previews

This commit is contained in:
Scott Nonnenberg 2019-01-15 19:03:56 -08:00
parent 91ef39e482
commit 813924685e
36 changed files with 2298 additions and 134 deletions

View file

@ -372,6 +372,15 @@ describe('Backup', () => {
return attachment;
})
),
preview: await Promise.all(
(message.preview || []).map(async item => {
if (item.image) {
await wrappedLoadAttachment(item.image);
}
return item;
})
),
});
}
@ -380,8 +389,9 @@ describe('Backup', () => {
// Seven total:
// - Five from image/video attachments
// - One from embedded contact avatar
// - Another from embedded quoted attachment thumbnail
const ATTACHMENT_COUNT = 7;
// - One from embedded quoted attachment thumbnail
// - One from a link preview image
const ATTACHMENT_COUNT = 8;
const MESSAGE_COUNT = 1;
const CONVERSATION_COUNT = 1;
@ -447,6 +457,17 @@ describe('Backup', () => {
},
},
],
preview: [
{
url: 'https://www.instagram.com/p/BsOGulcndj-/',
title:
'EGG GANG 🌍 on Instagram: “Lets set a world record together and get the most liked post on Instagram. Beating the current world record held by Kylie Jenner (18…”',
image: {
contentType: 'image/jpeg',
data: FIXTURES.jpg,
},
},
],
};
console.log('Backup test: Clear all data');