Skip to content

9f Solution #70

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: 9f
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ vi.mock('axios');
describe('Product component', () => {
let product;
let loadCart;
let user;

beforeEach(() => {
product = {
Expand All @@ -24,6 +25,7 @@ describe('Product component', () => {
};

loadCart = vi.fn();
user = userEvent.setup();
});

it('displays the product details correctly', () => {
Expand Down Expand Up @@ -53,7 +55,6 @@ describe('Product component', () => {
it('adds a product to the cart', async () => {
render(<Product product={product} loadCart={loadCart} />);

const user = userEvent.setup();
const addToCartButton = screen.getByTestId('add-to-cart-button');
await user.click(addToCartButton);

Expand All @@ -73,7 +74,6 @@ describe('Product component', () => {
const quantitySelector = screen.getByTestId('product-quantity-selector');
expect(quantitySelector).toHaveValue('1');

const user = userEvent.setup();
await user.selectOptions(quantitySelector, '3');
expect(quantitySelector).toHaveValue('3');

Expand Down