Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
rygine committed Dec 13, 2024
1 parent 2e06cac commit f055f84
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions bindings_node/test/Conversations.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,42 @@ describe('Conversations', () => {
expect((await client2.conversations().listGroups()).length).toBe(1)
})

it('should create a group with custom permissions', async () => {
const user1 = createUser()
const user2 = createUser()
const client1 = await createRegisteredClient(user1)
const client2 = await createRegisteredClient(user2)
const group = await client1
.conversations()
.createGroup([user2.account.address], {
permissions: GroupPermissionsOptions.CustomPolicy,
customPermissionPolicySet: {
addAdminPolicy: 2,
addMemberPolicy: 3,
removeAdminPolicy: 1,
removeMemberPolicy: 0,
updateGroupNamePolicy: 2,
updateGroupDescriptionPolicy: 1,
updateGroupImageUrlSquarePolicy: 0,
updateGroupPinnedFrameUrlPolicy: 3,
},
})
expect(group).toBeDefined()
expect(group.groupPermissions().policyType()).toBe(
GroupPermissionsOptions.CustomPolicy
)
expect(group.groupPermissions().policySet()).toEqual({
addAdminPolicy: 2,
addMemberPolicy: 3,
removeAdminPolicy: 1,
removeMemberPolicy: 0,
updateGroupNamePolicy: 2,
updateGroupDescriptionPolicy: 1,
updateGroupImageUrlSquarePolicy: 0,
updateGroupPinnedFrameUrlPolicy: 3,
})
})

it('should create a dm group', async () => {
const user1 = createUser()
const user2 = createUser()
Expand Down

0 comments on commit f055f84

Please sign in to comment.