Skip to content

Commit

Permalink
get all the tests passing
Browse files Browse the repository at this point in the history
  • Loading branch information
nplasterer committed Aug 19, 2024
1 parent ed2fa97 commit 7186792
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
11 changes: 5 additions & 6 deletions example/src/tests/groupTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -950,6 +950,8 @@ test('can stream groups', async () => {
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

View workflow job for this annotation

GitHub Actions / lint

Expected '===' and instead saw '=='

Check warning on line 953 in example/src/tests/groupTests.ts

View workflow job for this annotation

GitHub Actions / lint

Replace `"should·be·2"` with `'should·be·2'`

// 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])
Expand Down Expand Up @@ -2035,12 +2037,9 @@ test('can create new installation without breaking group', async () => {
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()

const client1 = await Client.create(wallet1, {
env: 'local',
appVersion: 'Testing/0.0.0',
Expand Down
14 changes: 12 additions & 2 deletions src/lib/Conversations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
} from './ConversationContainer'
import { DecodedMessage } from './DecodedMessage'
import { Group, GroupParams } from './Group'
import { Member } from './Member'
import { CreateGroupOptions } from './types/CreateGroupOptions'
import { EventTypes } from './types/EventTypes'
import { PermissionPolicySet } from './types/PermissionPolicySet'
Expand Down Expand Up @@ -149,7 +150,10 @@ export default class Conversations<
return
}
this.known[group.id] = true
await callback(new Group(this.client, group))
const members = group['members'].map((mem: string) => {
return Member.from(mem)
})
await callback(new Group(this.client, group, members))
}
)
this.subscriptions[EventTypes.Group] = groupsSubscription
Expand Down Expand Up @@ -286,10 +290,16 @@ export default class Conversations<

this.known[conversationContainer.topic] = true
if (conversationContainer.version === ConversationVersion.GROUP) {
const members = conversationContainer['members'].map(
(mem: string) => {
return Member.from(mem)
}
)
return await callback(
new Group(
this.client,
conversationContainer as unknown as GroupParams
conversationContainer as unknown as GroupParams,
members
)
)
} else {
Expand Down
1 change: 1 addition & 0 deletions src/lib/Group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export type PermissionUpdateOption = 'allow' | 'deny' | 'admin' | 'super_admin'
export interface GroupParams {
id: string
createdAt: number
members: string[]
creatorInboxId: InboxId
topic: string
name: string
Expand Down

0 comments on commit 7186792

Please sign in to comment.