Skip to content

Commit

Permalink
add reproduction test
Browse files Browse the repository at this point in the history
  • Loading branch information
nplasterer committed Jun 10, 2024
1 parent 297a27d commit 5f3b194
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions example/src/tests/groupTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -667,6 +667,46 @@ test('can remove and add members from a group by inbox id', async () => {
return true
})

test('stream groups and all messages', async () => {
const [alixClient, boClient] = await createClients(2)
console.log('Created clients')

const aliceGroups = await alixClient.conversations.listGroups()
console.log('Listed groups')
assert(aliceGroups.length === 0, 'alice should have no groups')

let groupCallbacks = 0
let messageCallbacks = 0

await alixClient.conversations.streamGroups(async () => {
groupCallbacks++
})

await alixClient.conversations.streamAllMessages(async () => {
messageCallbacks++
}, true)

console.log('setup streams')

await delayToPropogate()

const group = await boClient.conversations.newGroup([alixClient.address])
await group.send('hello')

console.log('created group')
assert(group instanceof Group, 'group should be a Group')

await delayToPropogate()

assert(groupCallbacks === 1, 'group stream should have received 1 group')
assert(
messageCallbacks === 1,
'message stream should have received 1 message'
)

return true
})

test('can stream groups', async () => {
const [alixClient, boClient, caroClient] = await createClients(3)

Expand Down

0 comments on commit 5f3b194

Please sign in to comment.