Skip to content

Commit

Permalink
Add a test for broken streaming between groups & messages
Browse files Browse the repository at this point in the history
  • Loading branch information
nmalzieu committed Sep 26, 2024
1 parent e9f6246 commit 9a30400
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions example/src/tests/groupTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2323,6 +2323,38 @@ test('only streams groups that can be decrypted', async () => {
return true
})

test('can stream groups and messages', async () => {
for (let index = 0; index < 15; index++) {
console.log(`stream groups & messages: test ${index}`)
const [alixClient, boClient] = await createClients(2)

// Start streaming groups
const groups: Group<any>[] = []
await alixClient.conversations.streamGroups(async (group: Group<any>) => {
groups.push(group)
})
// Stream messages twice
await alixClient.conversations.streamAllMessages(
async (message) => {},
true
)
await alixClient.conversations.streamAllMessages(
async (message) => {},
true
)

// bo creates a group with alix so a stream callback is fired
// eslint-disable-next-line @typescript-eslint/no-unused-vars
await boClient.conversations.newGroup([alixClient.address])
await delayToPropogate(500)
if ((groups.length as number) !== 1) {
throw Error(`Unexpected num groups (should be 1): ${groups.length}`)
}
}

return true
})

// Commenting this out so it doesn't block people, but nice to have?
// test('can stream messages for a long time', async () => {
// const bo = await Client.createRandom({ env: 'local', enableV3: true })
Expand Down

0 comments on commit 9a30400

Please sign in to comment.