Skip to content

Commit

Permalink
Fix error on component tests
Browse files Browse the repository at this point in the history
  • Loading branch information
islathehut committed Feb 3, 2025
1 parent c363a9a commit 6e47f6f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/mobile/src/components/Chat/Chat.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { ChannelMessagesComponentProps, ChatProps } from './Chat.types'
import { FileActionsProps } from '../UploadedFile/UploadedFile.types'
import { AttachmentButton } from '../AttachmentButton/AttachmentButton.component'
import DocumentPicker, { DocumentPickerResponse, types } from 'react-native-document-picker'
import { launchCamera, launchImageLibrary, ImagePickerResponse } from 'react-native-image-picker'
import { launchImageLibrary, ImagePickerResponse } from 'react-native-image-picker'
import UploadFilesPreviewsComponent from '../FileUploadingPreview/UploadingPreview.component'
import { defaultTheme } from '../../styles/themes/default.theme'
import { createLogger } from '../../utils/logger'
Expand Down
13 changes: 12 additions & 1 deletion packages/mobile/src/setupTests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,21 @@ jest.mock('socket.io-client', () => ({
io: jest.fn(),
}))

// Mocked because of: "Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'RNDocumentPicker'
// Mocked because of:
//
// "Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'RNDocumentPicker'
// could not be found. Verify that a module by this name is registered in the native binary."
jest.mock('react-native-document-picker', () => { })

// Mocked because of:
//
// /Users/isla/Dev/quiet/packages/mobile/node_modules/react-native-image-picker/src/index.ts:1
// ({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,jest){import {Platform} from 'react-native';
// ^^^^^^
//
// SyntaxError: Cannot use import statement outside a module
jest.mock('react-native-image-picker', () => { })

jest.mock('react-native-device-info', () => {
return {
getVersion: () => { return '1.0.0' }
Expand Down

0 comments on commit 6e47f6f

Please sign in to comment.