Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
684 B
4
Indexable
Never
it('testar se a função está ordenando os elementos da tabela', async () => {
    vi.spyOn(global, 'fetch').mockResolvedValue(mockData);
    await act(async () => {
      render(
        <ProviderPlanets>
          <App />
        </ProviderPlanets>
      )
    });
    const coluna = screen.getByTestId('column-filter');
    await userEvent.selectOptions(coluna, 'population');

    
    const asc = screen.getByTestId('column-sort-input-asc');
    await userEvent.click(asc);
    
    const btnOrdenar = screen.getByTestId('column-sort-button');
    await userEvent.click(btnOrdenar);

    let listaAsc = screen.getAllByTestId('planet-name');
    expect(listaAsc.length).toBe(10);
Leave a Comment