clearMessage & update on modifyChat & support for browser credentials

This commit is contained in:
Adhiraj Singh
2020-07-09 13:00:36 +05:30
parent 583c2adf28
commit 7a2a5e03a8
7 changed files with 112 additions and 29 deletions

View File

@@ -62,10 +62,14 @@ WAClientTest('Messages', (client) => {
})
it('should send a text message & delete it', async () => {
const message = await sendAndRetreiveMessage(client, 'hello fren', MessageType.text)
assert.strictEqual(message.message.conversation, 'hello fren')
await createTimeout (2000)
await client.deleteMessage (testJid, message.key)
})
it('should clear the most recent message', async () => {
const messages = await client.loadConversation (testJid, 1)
await createTimeout (2000)
await client.clearMessage (messages[0].key)
})
})
describe('Validate WhatsApp IDs', () => {
@@ -118,10 +122,9 @@ WAClientTest('Misc', (client) => {
await client.modifyChat (testJid, ChatModification.unarchive)
})
it('should pin & unpin a chat', async () => {
const pindate = new Date()
await client.modifyChat (testJid, ChatModification.pin, {stamp: pindate})
const response = await client.modifyChat (testJid, ChatModification.pin)
await createTimeout (2000)
await client.modifyChat (testJid, ChatModification.unpin, {stamp: pindate})
await client.modifyChat (testJid, ChatModification.unpin, {stamp: response.stamp})
})
it('should mute & unmute a chat', async () => {
const mutedate = new Date (new Date().getTime() + 8*60*60*1000) // 8 hours in the future
@@ -129,9 +132,6 @@ WAClientTest('Misc', (client) => {
await createTimeout (2000)
await client.modifyChat (testJid, ChatModification.unmute, {stamp: mutedate})
})
it('should unpin a chat', async () => {
await client.modifyChat (testJid, ChatModification.unpin)
})
it('should return search results', async () => {
const response = await client.searchMessages('Adh', 25, 0)
assert.ok (response.messages)