I have a component like this:
export const DetailsItem: FC = (): ReactElement => {
const { isInEditMode } = useAppSelector(({ editMode }) => editMode);
if (isInEditMode) {
return <DetailsItemEdit />;
}
return <DetailsItemDisplay />;
};
and am trying to test it.
describe('DetailsItem', () => {
it('should render DetailsItemDisplay component', () => {
render(
<Provider store={}> // I want to pass isInEditMode here.
<DetailsItem />
</Provider>,
);
screen.debug();
});
});
The problem is, I somehow need to mock the store, to match my case. Any ideas how I should handle this?
I remember in my previous project I used a npm package to do this, but can't find it now, and can't remember how I did it, or what it was called