Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nakajima committed Nov 28, 2023
1 parent 22213a6 commit a927f3d
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 52 deletions.
40 changes: 14 additions & 26 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ PODS:
- ExpoModulesCore
- EXFont (11.1.1):
- ExpoModulesCore
- EXImageLoader (4.3.0):
- EXImageLoader (4.4.0):
- ExpoModulesCore
- React-Core
- Expo (48.0.20):
- Expo (48.0.21):
- ExpoModulesCore
- ExpoDocumentPicker (11.5.4):
- ExpoDocumentPicker (11.7.0):
- ExpoModulesCore
- ExpoImagePicker (14.3.2):
- ExpoImagePicker (14.5.0):
- ExpoModulesCore
- ExpoKeepAwake (12.0.1):
- ExpoModulesCore
Expand Down Expand Up @@ -302,17 +302,13 @@ PODS:
- React-jsinspector (0.71.8)
- React-logger (0.71.8):
- glog
- react-native-blob-util (0.19.0):
- react-native-blob-util (0.19.4):
- React-Core
- react-native-encrypted-storage (4.0.3):
- React-Core
- react-native-get-random-values (1.8.0):
- React-Core
- react-native-mmkv (2.8.0):
- react-native-mmkv (2.11.0):
- MMKV (>= 1.2.13)
- React-Core
- react-native-randombytes (3.6.1):
- React-Core
- react-native-safe-area-context (4.5.0):
- RCT-Folly
- RCTRequired
Expand Down Expand Up @@ -406,7 +402,7 @@ PODS:
- RNScreens (3.20.0):
- React-Core
- React-RCTImage
- RNSVG (13.9.0):
- RNSVG (13.14.0):
- React-Core
- secp256k1.swift (0.1.4)
- SwiftProtobuf (1.20.3)
Expand Down Expand Up @@ -463,9 +459,7 @@ DEPENDENCIES:
- React-logger (from `../node_modules/react-native/ReactCommon/logger`)
- react-native-blob-util (from `../node_modules/react-native-blob-util`)
- react-native-encrypted-storage (from `../node_modules/react-native-encrypted-storage`)
- react-native-get-random-values (from `../node_modules/react-native-get-random-values`)
- react-native-mmkv (from `../node_modules/react-native-mmkv`)
- react-native-randombytes (from `../node_modules/react-native-randombytes`)
- react-native-safe-area-context (from `../node_modules/react-native-safe-area-context`)
- React-perflogger (from `../node_modules/react-native/ReactCommon/reactperflogger`)
- React-RCTActionSheet (from `../node_modules/react-native/Libraries/ActionSheetIOS`)
Expand Down Expand Up @@ -571,12 +565,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native-blob-util"
react-native-encrypted-storage:
:path: "../node_modules/react-native-encrypted-storage"
react-native-get-random-values:
:path: "../node_modules/react-native-get-random-values"
react-native-mmkv:
:path: "../node_modules/react-native-mmkv"
react-native-randombytes:
:path: "../node_modules/react-native-randombytes"
react-native-safe-area-context:
:path: "../node_modules/react-native-safe-area-context"
React-perflogger:
Expand Down Expand Up @@ -623,10 +613,10 @@ SPEC CHECKSUMS:
EXConstants: f348da07e21b23d2b085e270d7b74f282df1a7d9
EXFileSystem: 844e86ca9b5375486ecc4ef06d3838d5597d895d
EXFont: 6ea3800df746be7233208d80fe379b8ed74f4272
EXImageLoader: 34b214f9387e98f3c73989f15d8d5b399c9ab3f7
Expo: b7d2843b0a0027d0ce76121a63085764355a16ed
ExpoDocumentPicker: 5cb7389ff935b4addefdd466a606de51a512e922
ExpoImagePicker: c58fdf28be551681a8edc550bcec76c397a8dfcd
EXImageLoader: 03063370bc06ea1825713d3f55fe0455f7c88d04
Expo: 0d9f112757acc6bf32103eabccf91267780bd580
ExpoDocumentPicker: d3b6b0ed2dbbc2f05158e0294dd3f4673f386e5f
ExpoImagePicker: 9e5c745cb3e56ee00e1cfe5d6af59caab66ecf1a
ExpoKeepAwake: 69f5f627670d62318410392d03e0b5db0f85759a
ExpoModulesCore: 653958063a301098b541ae4dfed1ac0b98db607b
EXSplashScreen: 0e0a9ba0cf7553094e93213099bd7b42e6e237e9
Expand Down Expand Up @@ -656,11 +646,9 @@ SPEC CHECKSUMS:
React-jsiexecutor: 747911ab5921641b4ed7e4900065896597142125
React-jsinspector: c712f9e3bb9ba4122d6b82b4f906448b8a281580
React-logger: 342f358b8decfbf8f272367f4eacf4b6154061be
react-native-blob-util: 2b6627b288e3bd9874704ea9a153f0a179e4f3f5
react-native-blob-util: 30a6c9fd067aadf9177e61a998f2c7efb670598d
react-native-encrypted-storage: db300a3f2f0aba1e818417c1c0a6be549038deb7
react-native-get-random-values: a6ea6a8a65dc93e96e24a11105b1a9c8cfe1d72a
react-native-mmkv: 7da5e18e55c04a9af9a7e0ab9792a1e8d33765a1
react-native-randombytes: 421f1c7d48c0af8dbcd471b0324393ebf8fe7846
react-native-mmkv: e97c0c79403fb94577e5d902ab1ebd42b0715b43
react-native-safe-area-context: 39c2d8be3328df5d437ac1700f4f3a4f75716acc
React-perflogger: d21f182895de9d1b077f8a3cd00011095c8c9100
React-RCTActionSheet: 0151f83ef92d2a7139bba7dfdbc8066632a6d47b
Expand All @@ -676,7 +664,7 @@ SPEC CHECKSUMS:
React-runtimeexecutor: 7c51ae9d4b3e9608a2366e39ccaa606aa551b9ed
ReactCommon: 85c98ab0a509e70bf5ee5d9715cf68dbf495b84c
RNScreens: 218801c16a2782546d30bd2026bb625c0302d70f
RNSVG: 53c661b76829783cdaf9b7a57258f3d3b4c28315
RNSVG: d00c8f91c3cbf6d476451313a18f04d220d4f396
secp256k1.swift: a7e7a214f6db6ce5db32cc6b2b45e5c4dd633634
SwiftProtobuf: b02b5075dcf60c9f5f403000b3b0c202a11b6ae1
web3.swift: 2263d1e12e121b2c42ffb63a5a7beb1acaf33959
Expand Down
21 changes: 4 additions & 17 deletions example/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@
"react-native-blob-util": "^0.19.0",
"react-native-crypto": "^2.2.0",
"react-native-encrypted-storage": "^4.0.3",
"react-native-get-random-values": "^1.8.0",
"react-native-mmkv": "^2.8.0",
"react-native-randombytes": "^3.6.1",
"react-native-safe-area-context": "4.5.0",
"react-native-screens": "~3.20.0",
"react-native-svg": "^13.9.0",
Expand Down
28 changes: 21 additions & 7 deletions example/src/tests.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { content } from '@xmtp/proto'
import { randomBytes } from 'crypto'
import ReactNativeBlobUtil from 'react-native-blob-util'

import {
Expand Down Expand Up @@ -152,7 +151,7 @@ test('canMessage', async () => {

test('createFromKeyBundle throws error for non string value', async () => {
try {
const bytes = randomBytes(32)
const bytes = [1, 2, 3]
await Client.createFromKeyBundle(JSON.stringify(bytes), {
env: 'local',
})
Expand Down Expand Up @@ -231,8 +230,23 @@ test('can list batch messages', async () => {
throw Error('No message')
}

if (messages[0].contentTypeId !== 'org/reaction:1.0') {
throw Error('Unexpected message content ' + messages[0].content)
const getCircularReplacer = () => {

Check warning on line 233 in example/src/tests.ts

View workflow job for this annotation

GitHub Actions / lint

'getCircularReplacer' is assigned a value but never used
const seen = new WeakSet()
return (key, value) => {
if (typeof value === 'object' && value !== null) {
if (seen.has(value)) {
return
}
seen.add(value)
}
return value
}
}

if (messages[0].contentTypeId !== 'xmtp.org/reaction:1.0') {
throw Error(
'Unexpected message content ' + JSON.stringify(messages[0].contentTypeId)
)
}

if (messages[0].fallback !== 'Reacted “💖” to an earlier message') {
Expand Down Expand Up @@ -484,7 +498,7 @@ test('remote attachments should work', async () => {
}
const message = messages[0]

if (message.contentTypeId !== 'org/remoteStaticAttachment:1.0') {
if (message.contentTypeId !== 'xmtp.org/remoteStaticAttachment:1.0') {
throw new Error('Expected correctly formatted typeId')
}
if (!message.content().remoteAttachment) {
Expand Down Expand Up @@ -547,8 +561,8 @@ test('can send read receipts', async () => {
throw Error('No message')
}

if (bobMessages[0].contentTypeId !== 'org/readReceipt:1.0') {
throw Error('Unexpected message content ' + bobMessages[0].content)
if (bobMessages[0].contentTypeId !== 'xmtp.org/readReceipt:1.0') {
throw Error('Unexpected message content ' + bobMessages[0].contentTypeId)
}

if (bobMessages[0].fallback) {
Expand Down

0 comments on commit a927f3d

Please sign in to comment.