Skip to content

Commit

Permalink
test: add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rygine committed Oct 25, 2023
1 parent f8fc32e commit 4acf501
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions test/conversations/Conversation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ describe('conversation', () => {
expect(
alice.conversations.newConversation(alice.address)
).rejects.toThrow('self messaging not supported')
expect(
alice.conversations.newConversation(alice.address.toLowerCase())
).rejects.toThrow('self messaging not supported')
})

it('can send a prepared message v1', async () => {
Expand Down
13 changes: 13 additions & 0 deletions test/conversations/Conversations.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,19 @@ describe('conversations', () => {
expect(bobConvo instanceof ConversationV1).toBeTruthy()
})

it('does not create a duplicate conversation with an address case mismatch', async () => {
const convo1 = await alice.conversations.newConversation(bob.address)
await convo1.send('gm')
const convos = await alice.conversations.list()
expect(convos).toHaveLength(1)
const convo2 = await alice.conversations.newConversation(
bob.address.toLowerCase()
)
await convo2.send('gm')
const convos2 = await alice.conversations.list()
expect(convos2).toHaveLength(1)
})

it('continues to use v1 conversation even after upgrading bundle', async () => {
const aliceConvo = await alice.conversations.newConversation(bob.address)
await aliceConvo.send('gm')
Expand Down

0 comments on commit 4acf501

Please sign in to comment.