-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix timeout errors and add more fields to GroupWrapper #470
Changes from all commits
51acbaf
68f8c13
e21205b
d7defb7
fc6d792
fb050c6
7f685ef
ed2fa97
7186792
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -439,7 +439,7 @@ | |
|
||
await boClient.conversations.syncGroups() | ||
const boGroup = (await boClient.conversations.listGroups())[0] | ||
const addedByInboxId = await boGroup.addedByInboxId() | ||
const addedByInboxId = await boGroup.addedByInboxId | ||
|
||
assert( | ||
addedByInboxId === alixClient.inboxId, | ||
|
@@ -452,7 +452,7 @@ | |
const [alixClient, boClient] = await createClients(2) | ||
const group = await alixClient.conversations.newGroup([boClient.address]) | ||
|
||
const members = await group.members() | ||
const members = group.members | ||
|
||
assert(members.length === 2, `Should be 2 members but was ${members.length}`) | ||
|
||
|
@@ -514,10 +514,7 @@ | |
if (memberInboxIds.length !== 3) { | ||
throw new Error('num group members should be 3') | ||
} | ||
const peerInboxIds = await alixGroup.peerInboxIds | ||
if (peerInboxIds.length !== 2) { | ||
throw new Error('num peer group members should be 2') | ||
} | ||
|
||
if ( | ||
!( | ||
memberInboxIds.includes(alixClient.inboxId) && | ||
|
@@ -528,15 +525,6 @@ | |
throw new Error('missing address') | ||
} | ||
|
||
if ( | ||
!( | ||
peerInboxIds.includes(boClient.inboxId) && | ||
peerInboxIds.includes(caroClient.inboxId) | ||
) | ||
) { | ||
throw new Error('should include self') | ||
} | ||
|
||
// alix can send messages | ||
await alixGroup.send('hello, world') | ||
await alixGroup.send('gm') | ||
|
@@ -962,6 +950,8 @@ | |
throw Error('Unexpected num groups (should be 1): ' + groups.length) | ||
} | ||
|
||
assert(groups[0].members.length == 2, "should be 2") | ||
Check warning on line 953 in example/src/tests/groupTests.ts GitHub Actions / lint
|
||
|
||
// bo creates a group with alix so a stream callback is fired | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
const boGroup = await boClient.conversations.newGroup([alixClient.address]) | ||
|
@@ -2047,12 +2037,9 @@ | |
233, 120, 198, 96, 154, 65, 132, 17, 132, 96, 250, 40, 103, 35, 125, 64, | ||
166, 83, 208, 224, 254, 44, 205, 227, 175, 49, 234, 129, 74, 252, 135, 145, | ||
]) | ||
const wallet1 = new Wallet( | ||
'0xc54c62dd3ad018ef94f20f0722cae33919e65270ad74f2d1794291088800f788' | ||
) | ||
const wallet2 = new Wallet( | ||
'0x8d40c1c40473975cc6bbdc0465e70cc2e98f45f3c3474ca9b809caa9c4f53c0b' | ||
) | ||
const wallet1 = Wallet.createRandom() | ||
const wallet2 = Wallet.createRandom() | ||
Comment on lines
+2040
to
+2041
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These wallets are in the bad key package state so had to use random ones. I think this is better anyways. But good to know for future testing when we have a fix. |
||
|
||
const client1 = await Client.create(wallet1, { | ||
env: 'local', | ||
appVersion: 'Testing/0.0.0', | ||
|
@@ -2077,13 +2064,10 @@ | |
await client1Group?.sync() | ||
await client2Group?.sync() | ||
|
||
assert( | ||
(await client1Group?.members())?.length === 2, | ||
`client 1 should see 2 members` | ||
) | ||
assert(client1Group?.members?.length === 2, `client 1 should see 2 members`) | ||
|
||
assert( | ||
(await client2Group?.members())?.length === 2, | ||
(await client2Group?.membersList())?.length === 2, | ||
`client 2 should see 2 members` | ||
) | ||
|
||
|
@@ -2100,13 +2084,32 @@ | |
|
||
await client1Group?.send('This message will break the group') | ||
assert( | ||
(await client1Group?.members())?.length === 2, | ||
client1Group?.members?.length === 2, | ||
`client 1 should still see the 2 members` | ||
) | ||
|
||
return true | ||
}) | ||
|
||
test('can list many groups members in parallel', async () => { | ||
const [alix, bo] = await createClients(2) | ||
const groups: Group[] = await createGroups(alix, [bo], 20, 0) | ||
|
||
try { | ||
await Promise.all(groups.slice(0, 10).map((g) => g.membersList())) | ||
} catch (e) { | ||
throw new Error(`Failed listing 10 groups members with ${e}`) | ||
} | ||
|
||
try { | ||
await Promise.all(groups.slice(0, 20).map((g) => g.membersList())) | ||
} catch (e) { | ||
throw new Error(`Failed listing 20 groups members with ${e}`) | ||
} | ||
|
||
return true | ||
}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Only left this one test that was previously failing for me and passing now. |
||
|
||
// 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 }) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't want to duplicate the DB call to members so this is a breaking change for anyone who is using
peerInboxIds
directly but is easily mitigated by mapping on inboxID if desired.