chat updates bug fix

This commit is contained in:
Adhiraj
2020-09-05 19:54:47 +05:30
parent b645214926
commit cb9d511400
2 changed files with 29 additions and 16 deletions

View File

@@ -239,10 +239,18 @@ describe ('Pending Requests', () => {
conn.close ()
const result0 = await conn.connect ()
assert.deepEqual (result0.updatedChats, {})
conn.close ()
const oldChat = conn.chats.all()[0]
oldChat.archive = 'true' // mark the first chat as archived
oldChat.modify_tag = '1234' // change modify tag to detect change
// close the socket after a few seconds second to see if updates are correct after a reconnect
setTimeout (() => conn['conn'].close(), 5000)
const result = await conn.connect ()
assert.ok (!result.newConnection)
@@ -252,6 +260,8 @@ describe ('Pending Requests', () => {
assert.ok ('archive' in chat)
assert.equal (Object.keys(chat).length, 2)
assert.equal (Object.keys(result.updatedChats).length, 1)
conn.close ()
})
it('should queue requests when closed', async () => {