react-firebase-hooks
react-firebase-hooks copied to clipboard
Mock `useDocumentDataOnce` with jest
I am using useDocumentDataOnce
and trying to mock out the result but not being successful.
My understanding is that the first one is the data, second one is loading and the last one is the error, but this just makes the code get stuck in the test.
jest.mock("react-firebase-hooks/firestore", () => ({
useDocumentDataOnce: () => [
{
name: test,
},
false,
null,
],
}));
This link helped me out: https://stackoverflow.com/a/66091532/628699
Closing as the linked stackoverflow answers this question