Skip to content

Commit

Permalink
fix up the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nplasterer committed Apr 24, 2024
1 parent 10b3f25 commit 43dd2f1
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 8 deletions.
25 changes: 21 additions & 4 deletions example/src/tests/groupTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
})

Expand Down
10 changes: 6 additions & 4 deletions src/lib/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ import { DecodedMessage } from '../index'

declare const Buffer

export type GetMessageContentTypeFromClient<C> =
C extends Client<infer T> ? T : never
export type GetMessageContentTypeFromClient<C> = C extends Client<infer T>

Check warning on line 22 in src/lib/Client.ts

View workflow job for this annotation

GitHub Actions / lint

Replace `·C·extends·Client<infer·T>⏎··?·T⏎·` with `⏎··C·extends·Client<infer·T>·?·T`
? T
: never

export type ExtractDecodedType<C> =
C extends XMTPModule.ContentCodec<infer T> ? T : never
export type ExtractDecodedType<C> = C extends XMTPModule.ContentCodec<infer T>

Check warning on line 26 in src/lib/Client.ts

View workflow job for this annotation

GitHub Actions / lint

Replace `·C·extends·XMTPModule.ContentCodec<infer·T>⏎··?·T⏎·` with `⏎··C·extends·XMTPModule.ContentCodec<infer·T>·?·T`
? T
: never

export class Client<
ContentTypes extends DefaultContentTypes = DefaultContentTypes,
Expand Down

0 comments on commit 43dd2f1

Please sign in to comment.