Untitled

mail@pastecode.io avatar
unknown
plain_text
24 days ago
828 B
0
Indexable
Never
import { vi } from 'vitest';
import { act, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import App from '../../App';
import favoriteRecipes from './mock/FavoriteStorage';
import renderWithRouter from './renderWithRouter';

describe('FavoriteRecipes Component', () => {
  it('qualquer coisa', async () => {
    vi.spyOn(Storage.prototype, 'getItem').mockReturnValueOnce(JSON.stringify(favoriteRecipes));
    await act(async () => {
      renderWithRouter(<App />, { route: '/favorite-recipes' });
    });
    const textMeal = screen.queryByTestId('0-horizontal-top-text');
    expect(textMeal).toBeInTheDocument();
    const drinkButton = await screen.findByTestId('filter-by-drink-btn');
    await userEvent.click(drinkButton);
    expect(textMeal).toBeInTheDocument();
  });
});