mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
Added mutex + fixed rare duplicate chats bug + fixed connect bug
The mutex will prevent duplicate functions from being called and throwing funky errors.
This commit is contained in:
@@ -112,6 +112,14 @@ WAConnectionTest('Messages', conn => {
|
||||
}
|
||||
})
|
||||
})
|
||||
it('should not duplicate messages', async () => {
|
||||
const results = await Promise.all ([
|
||||
conn.loadMessages (testJid, 50),
|
||||
conn.loadMessages (testJid, 50)
|
||||
])
|
||||
assert.deepEqual (results[0].messages, results[1].messages)
|
||||
assert.ok (results[0].messages.length <= 50)
|
||||
})
|
||||
it('should deliver a message', async () => {
|
||||
const waitForUpdate =
|
||||
promiseTimeout(15000, resolve => {
|
||||
|
||||
Reference in New Issue
Block a user