Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to mock the react-native-raw-bottom-sheet ?? #133

Closed
PriyaMani-yara opened this issue May 25, 2021 · 7 comments
Closed

How to mock the react-native-raw-bottom-sheet ?? #133

PriyaMani-yara opened this issue May 25, 2021 · 7 comments

Comments

@PriyaMani-yara
Copy link

image
jest.mock("react-native-raw-bottom-sheet", () => ({
...jest.requireActual("react-native-raw-bottom-sheet"),
onOpen: jest.fn(),
}))

Please does any one have any idea?

@PriyaMani-yara PriyaMani-yara changed the title How to mock the react-native-raw-bottom-sheet ?? Got an error for Forward ref How to mock the react-native-raw-bottom-sheet ?? May 25, 2021
@Sub-Zero-1
Copy link

Any solution to this?

@Sub-Zero-1
Copy link

Maybe that helps someone:
const setModalVisible = jest.spyOn(RBSheet.prototype, 'setModalVisible');

@MorenoMdz
Copy link

Any ideas on how to do this?

@Abdulsami-Metafic
Copy link

image jest.mock("react-native-raw-bottom-sheet", () => ({ ...jest.requireActual("react-native-raw-bottom-sheet"), onOpen: jest.fn(), }))

Please does any one have any idea?

Hello @PriyaMani-yara Can you please let me know how did you fixed it?

@Abdulsami-Metafic
Copy link

Any ideas on how to do this?

Are you able to solve this?

@hetabytes
Copy link

Hello
I have found one of the solutions for this
You need to take package out of the node modules and then pass reference path of the package
It will resolve the issue also don't forget to mock the function

jest.mock("react-native-raw-bottom-sheet", () => ({ ...jest.requireActual("react-native-raw-bottom-sheet"), onOpen: jest.fn(), }));

@harit2305
Copy link

Hello I have found one of the solutions for this You need to take package out of the node modules and then pass reference path of the package It will resolve the issue also don't forget to mock the function

jest.mock("react-native-raw-bottom-sheet", () => ({ ...jest.requireActual("react-native-raw-bottom-sheet"), onOpen: jest.fn(), }));

its working thanks @hetabytes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants