Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
905 B
3
Indexable
Never
import React from 'react';
import { render, fireEvent } from '@testing-library/react';
import Recipes from './Recipes';

describe('Recipes component', () => {
  test('renders correctly', () => {
    render(<Recipes />);
  });

  test('handles click on All category filter button correctly', () => {
    const { getByTestId } = render(<Recipes />);
    const allCategoryFilterBtn = getByTestId('All-category-filter');
    fireEvent.click(allCategoryFilterBtn);
  });

  test('handles click on category filter buttons correctly', () => {
    const { getByTestId } = render(<Recipes />);
    const categoryFilterBtn = getByTestId('Categoria-category-filter');
    fireEvent.click(categoryFilterBtn);
  });

  test('handles click on recipe card correctly', () => {
    const { getByTestId } = render(<Recipes />);
    const recipeCard = getByTestId('0-recipe-card');
    fireEvent.click(recipeCard);
  });
});