From 4acf50120b379142cc5733655f9a1f9b00f320b8 Mon Sep 17 00:00:00 2001 From: Ry Racherbaumer Date: Wed, 25 Oct 2023 18:28:21 -0500 Subject: [PATCH] test: add tests --- test/conversations/Conversation.test.ts | 3 +++ test/conversations/Conversations.test.ts | 13 +++++++++++++ 2 files changed, 16 insertions(+) diff --git a/test/conversations/Conversation.test.ts b/test/conversations/Conversation.test.ts index 4bab7bf10..e7e354768 100644 --- a/test/conversations/Conversation.test.ts +++ b/test/conversations/Conversation.test.ts @@ -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 () => { diff --git a/test/conversations/Conversations.test.ts b/test/conversations/Conversations.test.ts index aff73b602..77aca19ff 100644 --- a/test/conversations/Conversations.test.ts +++ b/test/conversations/Conversations.test.ts @@ -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')