From b4896faaf530960e7502f08752c3a039d81e46f0 Mon Sep 17 00:00:00 2001 From: iyanfdezz Date: Sun, 7 Apr 2024 21:41:29 +0200 Subject: [PATCH] Aumentando coverage en Register --- webapp/src/components/Register/Register.test.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/webapp/src/components/Register/Register.test.js b/webapp/src/components/Register/Register.test.js index 614ba275..99d5c958 100644 --- a/webapp/src/components/Register/Register.test.js +++ b/webapp/src/components/Register/Register.test.js @@ -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" }; @@ -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", }); }); @@ -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", }); }); });