Skip to content

Commit

Permalink
test: disables the 'Carregar Mais' button when there are no new posts
Browse files Browse the repository at this point in the history
Co-Authored-By: Natalia Rodrigues <[email protected]>
  • Loading branch information
GabrielSMonteiro and Natyrodrigues committed Sep 20, 2024
1 parent bb52f2a commit 0c0341f
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/app/__tests__/forum.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,22 @@ describe("Forum", () => {
);
});
});

describe("Forum - Carregar Mais", () => {
it("desativa o botão 'Carregar Mais' quando não há novas publicações", async () => {
// Simulando a resposta com uma lista vazia de publicações
(getAllPublicacao as jest.Mock).mockResolvedValueOnce({
data: [],
});

const { queryByTestId } = render(<Forum />);

// Verifica se setShowCarregarMais(false) foi chamado (ou seja, o botão foi removido)
await waitFor(() => {
const botaoCarregarMais = queryByTestId("botaoCarregarMais");
expect(botaoCarregarMais).toBeNull(); // Verifica que o botão "Carregar Mais" foi removido
});
});
});

});

0 comments on commit 0c0341f

Please sign in to comment.