Added link previews

This commit is contained in:
Adhiraj
2020-07-14 13:30:15 +05:30
parent 3f84325bad
commit 8ce1e2da08
5 changed files with 45 additions and 28 deletions

View File

@@ -33,6 +33,14 @@ WAClientTest('Messages', (client) => {
const message = await sendAndRetreiveMessage(client, 'hello fren', MessageType.text)
assert.strictEqual(message.message.conversation, 'hello fren')
})
it('should send a link preview', async () => {
const content = await client.generateLinkPreview ('hello this is from https://www.github.com/adiwajshing/Baileys')
const message = await sendAndRetreiveMessage(client, content, MessageType.text)
const received = message.message.extendedTextMessage
assert.strictEqual(received.text, content.text)
fs.writeFileSync ('Media/received-thumb.jpeg', content.jpegThumbnail)
})
it('should quote a message', async () => {
const messages = await client.loadConversation(testJid, 2)
const message = await sendAndRetreiveMessage(client, 'hello fren 2', MessageType.extendedText, {
@@ -109,12 +117,6 @@ WAClientTest('Misc', (client) => {
it('should return the stories', async () => {
await client.getStories()
})
it('should return a preview', async () => {
const info = await client.urlQuery ('fren have you seen https://www.github.com/adiwajshing/Baileys')
assert.equal (info["matched-text"], 'https://www.github.com/adiwajshing/Baileys')
await assert.rejects (() => client.urlQuery('oh hello there'))
})
it('should return the profile picture', async () => {
const response = await client.getProfilePicture(testJid)
assert.ok(response)