diff --git a/src/Tests/Tests.Connect.ts b/src/Tests/Tests.Connect.ts index 4d0569b..71a8df1 100644 --- a/src/Tests/Tests.Connect.ts +++ b/src/Tests/Tests.Connect.ts @@ -33,7 +33,7 @@ describe('Test Connect', () => { const conn = new WAConnection() await conn.connect () - assert.ok(conn.user?.id) + assert.ok(conn.user?.jid) assert.ok(conn.user?.phone) assert.ok (conn.user?.imgUrl || conn.user.imgUrl === '') @@ -47,7 +47,7 @@ describe('Test Connect', () => { .connect ({timeoutMs: 20*1000}) .then (conn => { assert.ok(conn.user) - assert.ok(conn.user.id) + assert.ok(conn.user.jid) const chatArray = conn.chats.all() if (chatArray.length > 0) { @@ -57,10 +57,6 @@ describe('Test Connect', () => { assert.ok(chatArray[0].messages[0]) } } - const contactValues = Object.values(conn.contacts) - if (contactValues[0]) { - assert.ok(contactValues[0].jid) - } }) .then (() => conn.logout()) .then (() => conn.loadAuthInfo(auth)) @@ -162,7 +158,7 @@ describe ('Pending Requests', () => { conn.close () - const task: Promise = conn.query({json: ['query', 'Status', conn.user.id]}) + const task: Promise = conn.query({json: ['query', 'Status', conn.user.jid]}) await delay (2000) diff --git a/src/Tests/Tests.Groups.ts b/src/Tests/Tests.Groups.ts index aa45779..b53a086 100644 --- a/src/Tests/Tests.Groups.ts +++ b/src/Tests/Tests.Groups.ts @@ -31,7 +31,7 @@ WAConnectionTest('Groups', (conn) => { const waitForEvent = new Promise (resolve => { conn.on ('group-description-update', ({jid, actor}) => { if (jid === gid) { - assert.ok (actor, conn.user.id) + assert.ok (actor, conn.user.jid) resolve () } }) diff --git a/src/Tests/Tests.Messages.ts b/src/Tests/Tests.Messages.ts index 765706a..6f3db94 100644 --- a/src/Tests/Tests.Messages.ts +++ b/src/Tests/Tests.Messages.ts @@ -35,7 +35,7 @@ WAConnectionTest('Messages', (conn) => { assert.strictEqual(message.message.extendedTextMessage.contextInfo.stanzaId, messages[0].key.id) assert.strictEqual( message.message.extendedTextMessage.contextInfo.participant, - messages[0].key.fromMe ? conn.user.id : messages[0].key.id + messages[0].key.fromMe ? conn.user.jid : messages[0].key.id ) }) it('should send a gif', async () => { @@ -74,7 +74,7 @@ WAConnectionTest('Message Events', (conn) => { it('should deliver a message', async () => { const waitForUpdate = promiseTimeout(15000, resolve => { - conn.on('message-update', update => { + conn.on('message-status-update', update => { if (update.ids.includes(response.key.id)) { resolve(update) } diff --git a/src/Tests/Tests.Misc.ts b/src/Tests/Tests.Misc.ts index bf06015..bb1b00a 100644 --- a/src/Tests/Tests.Misc.ts +++ b/src/Tests/Tests.Misc.ts @@ -21,7 +21,7 @@ WAConnectionTest('Misc', (conn) => { const waitForEvent = new Promise (resolve => { conn.on ('user-status-update', ({jid, status}) => { - if (jid === conn.user.id) { + if (jid === conn.user.jid) { assert.equal (status, newStatus) conn.removeAllListeners ('user-status-update') resolve () @@ -50,16 +50,16 @@ WAConnectionTest('Misc', (conn) => { it('should change the profile picture', async () => { await delay (5000) - const ppUrl = await conn.getProfilePicture(conn.user.id) + const ppUrl = await conn.getProfilePicture(conn.user.jid) const fetched = await fetch(ppUrl, { headers: { Origin: 'https://web.whatsapp.com' } }) const buff = await fetched.buffer () const newPP = await fs.readFile ('./Media/cat.jpeg') - const response = await conn.updateProfilePicture (conn.user.id, newPP) + const response = await conn.updateProfilePicture (conn.user.jid, newPP) await delay (10000) - await conn.updateProfilePicture (conn.user.id, buff) // revert back + await conn.updateProfilePicture (conn.user.jid, buff) // revert back }) it('should return the profile picture', async () => { const response = await conn.getProfilePicture(testJid)