Skip to content

Commit

Permalink
tests: atualiza testes de userUpdate
Browse files Browse the repository at this point in the history
  • Loading branch information
clara-ribeiro committed Dec 13, 2024
1 parent 69f92f5 commit 74d6df4
Showing 1 changed file with 0 additions and 26 deletions.
26 changes: 0 additions & 26 deletions src/Pages/Protected/Users/userUpdate/index.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
getRoles,
getLoggedUser,
updateLogged,
changePasswordInProfile,
} from "../../../../Services/userService";
import "@testing-library/jest-dom";

Expand Down Expand Up @@ -143,29 +142,4 @@ describe("UserUpdate", () => {
expect(screen.getByText("Alterações Salvas")).toBeInTheDocument();
});
});

it("saves password correctly", async () => {
setup();

fireEvent.click(screen.getByText("Editar senha"));
fireEvent.change(screen.getByLabelText("Senha atual"), {
target: { value: "oldPassword123" },
});
fireEvent.change(screen.getByLabelText("Nova senha"), {
target: { value: "newPassword123" },
});
fireEvent.change(screen.getByLabelText("Repetir nova senha"), {
target: { value: "newPassword123" },
});

fireEvent.click(screen.getByText("Alterar senha"));

await waitFor(() => {
expect(changePasswordInProfile).toHaveBeenCalledWith({
old_password: "oldPassword123",
new_password: "newPassword123",
});
expect(screen.getByText("Alterações Salvas")).toBeInTheDocument();
});
});
});

0 comments on commit 74d6df4

Please sign in to comment.