'Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'FileReaderModule' could not be found. (React native)

Getting error while unit testing :

Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'FileReaderModule' could not be found. Verify that a module by this name is registered in the native binary.

Payslip.test.js

import {render} from '@testing-library/react-native';
import Payslip from '../Payslip';

jest.mock('@react-native-async-storage/async-storage', () => {   
  return {
    multiSet: jest.fn(),
    multiRemove: jest.fn(),
    multiMerge: jest.fn(),
  };
});

jest.mock('@react-native-community/netinfo', () => {
  return {
    configure: jest.fn(),
    fetch: jest.fn(),
    addEventListener: jest.fn(),
    useNetInfo: jest.fn(),
  };
});

test('form submits two answers', () => {
  const {getByTestId} = render(<Payslip />);

  let Header = getByTestId('header');
  expect(Header).toBeTruthy();
});



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source