Skip to content

Commit

Permalink
Aumentando coverage en Register
Browse files Browse the repository at this point in the history
  • Loading branch information
iyanfdezz committed Apr 7, 2024
1 parent 5e96d2a commit b4896fa
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions webapp/src/components/Register/Register.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import i18n from "../../i18n.js";
jest.mock("axios");

const password = process.env.REGISTER_PASSWORD || "testpassword";
const apiEndpoint =
process.env.REACT_APP_API_ENDPOINT || "http://localhost:8000";

describe("Register Component", () => {
const mockSuccessResponse = { data: "Usuario registrado exitosamente" };
Expand Down Expand Up @@ -75,9 +77,9 @@ describe("Register Component", () => {
expect(
screen.getByText("Usuario registrado exitosamente")
).toBeInTheDocument();
expect(axios.post).toHaveBeenCalledWith("http://localhost:8000/adduser", {
expect(axios.post).toHaveBeenCalledWith(`${apiEndpoint}/adduser`, {
username: "testUser",
password: password,
password: "testPassword",
});
});

Expand All @@ -98,9 +100,9 @@ describe("Register Component", () => {
expect(
screen.getByText("Error: Error al registrar usuario")
).toBeInTheDocument();
expect(axios.post).toHaveBeenCalledWith("http://localhost:8000/adduser", {
expect(axios.post).toHaveBeenCalledWith(`${apiEndpoint}/adduser`, {
username: "testUser",
password: password,
password: "testPassword",
});
});
});

0 comments on commit b4896fa

Please sign in to comment.