Skip to content

Commit

Permalink
add a new test file for dms
Browse files Browse the repository at this point in the history
  • Loading branch information
nplasterer committed Oct 25, 2024
1 parent f4b10aa commit 8aa5552
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
7 changes: 7 additions & 0 deletions example/src/TestScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { restartStreamTests } from './tests/restartStreamsTests'
import { Test } from './tests/test-utils'
import { tests } from './tests/tests'
import { v3OnlyTests } from './tests/v3OnlyTests'
import { dmTests } from './tests/dmTests'

Check warning on line 12 in example/src/TestScreen.tsx

View workflow job for this annotation

GitHub Actions / lint

`./tests/dmTests` import should occur before import of `./tests/groupPerformanceTests`

type Result = 'waiting' | 'running' | 'success' | 'failure' | 'error'

Expand Down Expand Up @@ -107,6 +108,7 @@ function TestView({
export enum TestCategory {
all = 'all',
tests = 'tests',
dm = 'dm',
group = 'group',
v3Only = 'v3Only',
restartStreans = 'restartStreams',
Expand All @@ -123,6 +125,7 @@ export default function TestScreen(): JSX.Element {
const allTests = [
...tests,
...groupTests,
...dmTests,
...v3OnlyTests,
...restartStreamTests,
...groupPermissionsTests,
Expand All @@ -142,6 +145,10 @@ export default function TestScreen(): JSX.Element {
activeTests = groupTests
title = 'Group Unit Tests'
break
case TestCategory.dm:
activeTests = dmTests
title = 'Dm Unit Tests'
break
case TestCategory.v3Only:
activeTests = v3OnlyTests
title = 'V3 Only Tests'
Expand Down
24 changes: 24 additions & 0 deletions example/src/tests/dmTests.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { Wallet } from 'ethers'

Check warning on line 1 in example/src/tests/dmTests.ts

View workflow job for this annotation

GitHub Actions / lint

'Wallet' is defined but never used
import { Platform } from 'expo-modules-core'

Check warning on line 2 in example/src/tests/dmTests.ts

View workflow job for this annotation

GitHub Actions / lint

'Platform' is defined but never used
import { DecodedMessage } from 'xmtp-react-native-sdk/lib/DecodedMessage'

Check warning on line 3 in example/src/tests/dmTests.ts

View workflow job for this annotation

GitHub Actions / lint

'DecodedMessage' is defined but never used

import {

Check warning on line 5 in example/src/tests/dmTests.ts

View workflow job for this annotation

GitHub Actions / lint

Replace `⏎··Test,⏎··assert,⏎··createClients,⏎··delayToPropogate,⏎` with `·Test,·assert,·createClients,·delayToPropogate·`
Test,
assert,

Check warning on line 7 in example/src/tests/dmTests.ts

View workflow job for this annotation

GitHub Actions / lint

'assert' is defined but never used
createClients,

Check warning on line 8 in example/src/tests/dmTests.ts

View workflow job for this annotation

GitHub Actions / lint

'createClients' is defined but never used
delayToPropogate,

Check warning on line 9 in example/src/tests/dmTests.ts

View workflow job for this annotation

GitHub Actions / lint

'delayToPropogate' is defined but never used
} from './test-utils'
import {
Client,

Check warning on line 12 in example/src/tests/dmTests.ts

View workflow job for this annotation

GitHub Actions / lint

'Client' is defined but never used
Conversation,

Check warning on line 13 in example/src/tests/dmTests.ts

View workflow job for this annotation

GitHub Actions / lint

'Conversation' is defined but never used
Dm,
Group,
ConversationContainer,
ConversationVersion,
} from '../../../src/index'

export const dmTests: Test[] = []
let counter = 1
function test(name: string, perform: () => Promise<boolean>) {
dmTests.push({ name: String(counter++) + '. ' + name, run: perform })
}
5 changes: 3 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { Client } from '.'
import { ConversationContext } from './XMTP.types'
import XMTPModule from './XMTPModule'
import { InboxId } from './lib/Client'
import { WalletType } from './lib/Signer'
import { ConsentListEntry, ConsentState } from './lib/ConsentListEntry'
import {
ContentCodec,
Expand All @@ -19,16 +18,17 @@ import {
ConversationVersion,
} from './lib/ConversationContainer'
import { DecodedMessage, MessageDeliveryStatus } from './lib/DecodedMessage'
import { Dm } from './lib/Dm'
import { Group, PermissionUpdateOption } from './lib/Group'
import { InboxState } from './lib/InboxState'
import { Member } from './lib/Member'
import type { Query } from './lib/Query'
import { WalletType } from './lib/Signer'
import { ConversationSendPayload } from './lib/types'
import { DefaultContentTypes } from './lib/types/DefaultContentType'
import { ConversationOrder, GroupOptions } from './lib/types/GroupOptions'
import { PermissionPolicySet } from './lib/types/PermissionPolicySet'
import { getAddress } from './utils/address'
import { Dm } from './lib/Dm'

export * from './context'
export * from './hooks'
Expand Down Expand Up @@ -1513,6 +1513,7 @@ export { Query } from './lib/Query'
export { XMTPPush } from './lib/XMTPPush'
export { ConsentListEntry, DecodedMessage, MessageDeliveryStatus }
export { Group } from './lib/Group'
export { Dm } from './lib/Dm'
export { Member } from './lib/Member'
export { InboxId } from './lib/Client'
export { GroupOptions, ConversationOrder } from './lib/types/GroupOptions'

0 comments on commit 8aa5552

Please sign in to comment.