mirror of
https://github.com/cheveguerra/whatsapp-web.js.git
synced 2026-04-18 03:29:14 +00:00
Added Tests
This commit is contained in:
@@ -349,7 +349,16 @@ END:VCARD`;
|
||||
expect(msg.vCards[1]).to.match(/BEGIN:VCARD/);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Get Messages', function() {
|
||||
it ('can get a message by it\'s ID', async function() {
|
||||
const chat = await client.getChatById(remoteId);
|
||||
const [message] = await chat.fetchMessages({limit: 1});
|
||||
const messageById = await client.getMessageById(message.id._serialized);
|
||||
expect(messageById).to.exist;
|
||||
expect(messageById).to.be.instanceOf(Message);
|
||||
expect(messageById).to.be.equal(message);
|
||||
})
|
||||
});
|
||||
describe('Get Chats', function () {
|
||||
it('can get a chat by its ID', async function () {
|
||||
const chat = await client.getChatById(remoteId);
|
||||
@@ -385,7 +394,6 @@ END:VCARD`;
|
||||
expect(contact).to.be.instanceOf(Contact);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Numbers and Users', function () {
|
||||
it('can verify that a user is registered', async function () {
|
||||
const isRegistered = await client.isRegisteredUser(remoteId);
|
||||
@@ -414,4 +422,4 @@ END:VCARD`;
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user