The package 'analytics-react-native' can't access a custom native module while testing in react native

258 views Asked by At

analytics-react-native giving me this warning when I run test on it.

    console.warn
      The package 'sovran-react-native' doesn't seem to be linked. Make sure: 
      
      - You have run 'pod install'
      - You rebuilt the app after installing the package
      - You are not using Expo managed workflow

and

 The package 'analytics-react-native' can't access a custom native module. Make sure: 
      
      - You have run 'pod install'
      - You rebuilt the app after installing the package
      - You are not using Expo managed workflow

I tried to mock it like

jest.mock('@segment/analytics-react-native', () => ({
  setup: jest.fn(),
  identify: jest.fn(),
  reset: jest.fn(),
}));

but it gives error

Super expression must either be null or a function

What is the proper way to test it or create mock of it?

0

There are 0 answers