From 43dd2f1e510dde0c820083abb087c698cdfc8295 Mon Sep 17 00:00:00 2001 From: Naomi Plasterer Date: Wed, 24 Apr 2024 15:10:42 -0700 Subject: [PATCH] fix up the tests --- example/src/tests/groupTests.ts | 25 +++++++++++++++++++++---- src/lib/Client.ts | 10 ++++++---- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/example/src/tests/groupTests.ts b/example/src/tests/groupTests.ts index 18f423fad..c3d1ae5df 100644 --- a/example/src/tests/groupTests.ts +++ b/example/src/tests/groupTests.ts @@ -738,10 +738,27 @@ test('canMessage', async () => { const [caro, chux] = await createClients(2) - const canMessageV3 = await caro.canGroupMessage([chux.address]) - if (!canMessageV3) { - throw new Error('should be able to message v3 client') - } + const canMessageV3 = await caro.canGroupMessage([ + chux.address, + alix.address, + '0x0000000000000000000000000000000000000000', + ]) + + assert( + canMessageV3['0x0000000000000000000000000000000000000000'] === false, + `should not be able to message 0x0000000000000000000000000000000000000000` + ) + + assert( + canMessageV3[chux.address.toLowerCase()] === true, + `should be able to message ${chux.address}` + ) + + assert( + canMessageV3[alix.address.toLowerCase()] === true, + `should be able to message ${alix.address}` + ) + return true }) diff --git a/src/lib/Client.ts b/src/lib/Client.ts index 16d4b1453..e7571842c 100644 --- a/src/lib/Client.ts +++ b/src/lib/Client.ts @@ -19,11 +19,13 @@ import { DecodedMessage } from '../index' declare const Buffer -export type GetMessageContentTypeFromClient = - C extends Client ? T : never +export type GetMessageContentTypeFromClient = C extends Client + ? T + : never -export type ExtractDecodedType = - C extends XMTPModule.ContentCodec ? T : never +export type ExtractDecodedType = C extends XMTPModule.ContentCodec + ? T + : never export class Client< ContentTypes extends DefaultContentTypes = DefaultContentTypes,