How to effectively mock @kesha-antonov/react-native-action-cable for Jest tests in a React Native project?

I’m currently working on a React Native project that utilizes @kesha-antonov/react-native-action-cable for WebSocket connections. As part of my testing strategy, I’m using Jest for unit testing. However, I’m facing challenges in properly mocking @kesha-antonov/react-native-action-cable within my Jest tests.

Here’s the mock implementation I’ve attempted:

    jest.mock('@kesha-antonov/react-native-action-cable', () => ({
      ActionCable: jest.fn().mockImplementation(() => ({
        createConsumer: jest.fn().mockImplementation(() => ({})),
      })),
      Cable: jest.fn().mockImplementation(() => {}),
    }));

Despite this mock setup, I’m having difficulty mocking the functionality of ActionCable and createConsumer effectively within my tests. It seems that the mock is not behaving as expected.

Could someone provide guidance on how to properly mock @kesha-antonov/react-native-action-cable for Jest tests in a React Native environment?