Untitled

 avatar
unknown
plain_text
2 years ago
905 B
6
Indexable
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);
  });
});
Editor is loading...