How do you unit test (with jest and enzyme) a functional component that uses the useReactiveVar hook?
Should I mock the useReactiveVar hook with jest?
How do you unit test (with jest and enzyme) a functional component that uses the useReactiveVar hook?
Should I mock the useReactiveVar hook with jest?
you can mock whole apollo client in each test to give different responses. I mean:
jest.mock('@apollo/client', () => ({
makeVar: () => {
return {};
},
useReactiveVar: () => {
return { account: { name: 'Test' } };
},
}));
But this is helpful only when testing component that use only one reactiveVar at all.