Skip to content

Commit

Permalink
fix: add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nplasterer committed Nov 13, 2024
1 parent 9471bd1 commit 3c0c0a3
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
16 changes: 16 additions & 0 deletions example/src/tests/clientTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,3 +281,19 @@ test('production client creation does not error', async () => {
}
return true
})

test('can find others inbox states', async () => {
const [alix, bo, caro] = await createClients(3)

const states = await alix.inboxStates(true, [bo.inboxId, caro.inboxId])
assert(
states[0].recoveryAddress.toLowerCase === bo.address.toLowerCase,
`addresses dont match ${states[0].recoveryAddress} and ${bo.address}`
)
assert(
states[1].addresses[0].toLowerCase === caro.address.toLowerCase,
`clients dont match ${states[1].addresses[0]} and ${caro.address}`
)

return true
})
15 changes: 15 additions & 0 deletions example/src/tests/conversationTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,21 @@ test('can find a conversation by topic', async () => {
return true
})

test('can find a dm by inbox id', async () => {
const [alixClient, boClient] = await createClients(2)
const alixDm = await alixClient.conversations.findOrCreateDm(boClient.address)

await boClient.conversations.sync()
const boDm = await boClient.conversations.findDmByInboxId(alixClient.inboxId)

assert(
boDm?.id === alixDm.id,
`bo dm id ${boDm?.id} does not match alix dm id ${alixDm.id}`
)

return true
})

test('can find a dm by address', async () => {
const [alixClient, boClient] = await createClients(2)
const alixDm = await alixClient.conversations.findOrCreateDm(boClient.address)
Expand Down

0 comments on commit 3c0c0a3

Please sign in to comment.