Closed nursahketene closed 3 years ago
Hey @nursahketene
You could do something similar like I did here: https://github.com/notrab/react-use-cart/blob/main/test/index.test.tsx#L15
You could also pass a unique ID to the CartProvider which will make sure it's set empty, as it won't attach to an existing one if is a unique value is given.
Perfect. thank you I was looking for this :D cleaning the window locale is a good solution for me :D
I want to write a test which basically checks the total cart item number is currently visible.
So in my _app.js I have something like this
On my product page I have function to update the cart
And in my test I would like to test the total items
However in this case I will get an error as the second test condition for checking 0 count is not correct. It will receive 1 as a total number of items.
Is there a way that I can clean the cart before each test in
afterEach()