|
| 1 | +import * as assert from 'assert'; |
| 2 | +import { describeAuthenticatedTest, testUserId } from './common'; |
| 3 | +import * as wppconnect from '../'; |
| 4 | + |
| 5 | +describeAuthenticatedTest('Basic functions', function (getClient) { |
| 6 | + it('getAllChats', function (done) { |
| 7 | + getClient() |
| 8 | + .getAllChats() |
| 9 | + .then((result) => { |
| 10 | + assert.ok(result); |
| 11 | + done(); |
| 12 | + }); |
| 13 | + }); |
| 14 | + |
| 15 | + it('getAllGroups', function (done) { |
| 16 | + getClient() |
| 17 | + .getAllGroups() |
| 18 | + .then((result) => { |
| 19 | + assert.ok(result); |
| 20 | + done(); |
| 21 | + }); |
| 22 | + }); |
| 23 | + |
| 24 | + it('getNumberProfile', async function () { |
| 25 | + const result = await getClient().getNumberProfile(testUserId); |
| 26 | + assert.ok(result); |
| 27 | + }); |
| 28 | + |
| 29 | + it('getAllUnreadMessages', async function () { |
| 30 | + const result = await getClient().getAllUnreadMessages(); |
| 31 | + assert.ok(result); |
| 32 | + }); |
| 33 | + |
| 34 | + it('getAllContacts', async function () { |
| 35 | + const result = await getClient().getAllContacts(); |
| 36 | + assert.ok(result); |
| 37 | + }); |
| 38 | + |
| 39 | + it('getAllChatsWithMessages', async function () { |
| 40 | + const result = await getClient().getAllChatsWithMessages(); |
| 41 | + assert.ok(result); |
| 42 | + }); |
| 43 | + |
| 44 | + it('getAllMessagesInChat', async function () { |
| 45 | + const result = await getClient().getAllMessagesInChat( |
| 46 | + testUserId, |
| 47 | + true, |
| 48 | + false |
| 49 | + ); |
| 50 | + assert.ok(result); |
| 51 | + }); |
| 52 | + |
| 53 | + it('getAllUnreadMessages', async function () { |
| 54 | + const result = await getClient().getAllUnreadMessages(); |
| 55 | + assert.ok(result); |
| 56 | + }); |
| 57 | + |
| 58 | + it('getBatteryLevel', async function () { |
| 59 | + const result = await getClient().getBatteryLevel(); |
| 60 | + assert.ok(result); |
| 61 | + }); |
| 62 | + |
| 63 | + it('getBlockList', async function () { |
| 64 | + const result = await getClient().getBlockList(); |
| 65 | + assert.ok(result); |
| 66 | + }); |
| 67 | + |
| 68 | + it('getChatById', async function () { |
| 69 | + const result = await getClient().getChatById(testUserId); |
| 70 | + assert.ok(result); |
| 71 | + }); |
| 72 | + |
| 73 | + it('getChatIsOnline', async function () { |
| 74 | + const result = await getClient().getChatIsOnline(testUserId); |
| 75 | + assert.ok(typeof result === 'boolean'); |
| 76 | + }); |
| 77 | + |
| 78 | + it('getConnectionState', async function () { |
| 79 | + const result = await getClient().getConnectionState(); |
| 80 | + assert.ok(result); |
| 81 | + }); |
| 82 | + |
| 83 | + it('getContact', async function () { |
| 84 | + const result = await getClient().getContact(testUserId); |
| 85 | + assert.ok(result); |
| 86 | + }); |
| 87 | + |
| 88 | + it('getHostDevice', async function () { |
| 89 | + const result = await getClient().getHostDevice(); |
| 90 | + assert.ok(result); |
| 91 | + }); |
| 92 | + |
| 93 | + it('getLastSeen', async function () { |
| 94 | + const result = await getClient().getLastSeen(testUserId); |
| 95 | + assert.ok(result); |
| 96 | + }); |
| 97 | + |
| 98 | + it('getListMutes', async function () { |
| 99 | + const result = await getClient().getListMutes(); |
| 100 | + assert.ok(result); |
| 101 | + }); |
| 102 | + |
| 103 | + // it('getMessageById', async function () { |
| 104 | + // const result = await getClient().getMessageById(); |
| 105 | + // assert.ok(result); |
| 106 | + // }); |
| 107 | + |
| 108 | + it('getProfilePicFromServer', async function () { |
| 109 | + const result = await getClient().getProfilePicFromServer(testUserId); |
| 110 | + assert.ok(result); |
| 111 | + }); |
| 112 | + |
| 113 | + it('getStatus', async function () { |
| 114 | + const result = await getClient().getStatus(testUserId); |
| 115 | + assert.ok(result); |
| 116 | + }); |
| 117 | + |
| 118 | + it('getTheme', async function () { |
| 119 | + const result = await getClient().getTheme(); |
| 120 | + assert.ok(result); |
| 121 | + }); |
| 122 | + |
| 123 | + it('getWAVersion', async function () { |
| 124 | + const result = await getClient().getWAVersion(); |
| 125 | + assert.ok(result); |
| 126 | + }); |
| 127 | + |
| 128 | + it('loadAndGetAllMessagesInChat', async function () { |
| 129 | + const result = await getClient().loadAndGetAllMessagesInChat( |
| 130 | + testUserId, |
| 131 | + true, |
| 132 | + true |
| 133 | + ); |
| 134 | + assert.ok(result); |
| 135 | + }); |
| 136 | + |
| 137 | + it('sendText', async function () { |
| 138 | + const result = await getClient().sendText(testUserId, 'Send Text'); |
| 139 | + assert.ok(result); |
| 140 | + }); |
| 141 | +}); |
0 commit comments