Skip to content

Commit

Permalink
write a test
Browse files Browse the repository at this point in the history
  • Loading branch information
nplasterer committed May 30, 2024
1 parent f35e048 commit b798789
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion example/src/tests/groupTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1238,7 +1238,7 @@ test('creating a group should allow group', async () => {
const consentList = await alix.contacts.consentList()
assert(
consentList[0].value === 'allowed',
`the message should have a consent state of allowed but was ${state}`
`the message should have a consent state of allowed but was ${consentList[0].value}`
)

return true
Expand Down Expand Up @@ -1283,6 +1283,32 @@ test('can deny a group', async () => {
return true
})

test('can allow and deny a inbox id', async () => {
const [alix, bo] = await createClients(2)
const startConsent = await bo.contacts.isInboxAllowed(alix.inboxId)
if (startConsent) {
throw Error('inbox id should be unknown')
}
await bo.contacts.denyInboxes([alix.inboxId])
const isDenied = await bo.contacts.isInboxDenied(alix.inboxId)
if (!isDenied) {
throw Error('inbox id should be denied')
}
await bo.contacts.allowInboxes([alix.inboxId])
const isAllowed = await bo.contacts.isInboxAllowed(alix.inboxId)
if (!isAllowed) {
throw Error('inbox id should be allowed')
}

const consentList = await bo.contacts.consentList()
assert(
consentList[0].entryType === 'inbox_id',
`the message should have a consent state of allowed but was ${consentList[0].entryType}`
)

return true
})

test('can check if group is allowed', async () => {
const [alix, bo] = await createClients(2)
const alixGroup = await alix.conversations.newGroup([bo.address])
Expand Down

0 comments on commit b798789

Please sign in to comment.