I got this error in the “18-Exercise- Testing Data Rendering” in the “Mocking Apis” section and even tho I try to fix it by wrapping the renderComponent with CartProvider but I still got the same error and it not show anything on console
Course : complete-react-testing-course
const renderComponent = () => {
render(
<CartProvider>
<Theme>
<BrowseProducts />
</Theme>
</CartProvider>
);
};
it("should render categories", async () => {
renderComponent();
const combobox = await screen.findByRole("combobox");
expect(combobox).not.toBeInTheDocument();
const user = userEvent.setup();
await user.click(combobox);
expect(screen.getByRole("option", { name: /all/i })).toBeInTheDocument();
categories.forEach((category) => {
expect(
screen.getByRole("option", { name: category.name })
).toBeInTheDocument();
});
});