mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
feat: implement event buffer for offline msgs
!BREAKING_CHANGE 1. this allows all offline notifications to be combined into a batch -- to reduce the number of events being sent out 2. to enable the above, the "message.reaction" event has been made an array. Also removes the need for the "operation" field 3. have also now started processing all events under a single queue to prevent state sync problems
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
import { AccountSettings, ChatMutation, Contact, InitialAppStateSyncOptions } from '../Types'
|
||||
import { unixTimestampSeconds } from '../Utils'
|
||||
import { processSyncActions } from '../Utils/chat-utils'
|
||||
import { processSyncAction } from '../Utils/chat-utils'
|
||||
import logger from '../Utils/logger'
|
||||
import { jidEncode } from '../WABinary'
|
||||
|
||||
describe('App State Sync Tests', () => {
|
||||
|
||||
@@ -59,7 +58,7 @@ describe('App State Sync Tests', () => {
|
||||
]
|
||||
|
||||
for(const mutations of CASES) {
|
||||
const events = processSyncActions(mutations, me, undefined, logger)
|
||||
const events = processSyncAction(mutations, me, undefined, logger)
|
||||
expect(events['chats.update']).toHaveLength(1)
|
||||
const event = events['chats.update']?.[0]
|
||||
expect(event.archive).toEqual(false)
|
||||
@@ -205,8 +204,4 @@ describe('App State Sync Tests', () => {
|
||||
expect(event.archive).toEqual(true)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
function randomJid() {
|
||||
return jidEncode(Math.floor(Math.random() * 1000000), Math.random() < 0.5 ? 's.whatsapp.net' : 'g.us')
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user