Added Tests

This commit is contained in:
Rajeh Taher
2021-08-28 00:43:29 +03:00
committed by GitHub
parent 841719ff4c
commit 7a8e922696

View File

@@ -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`;
});
});
});
});
});