-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #241 from wizelineacademy/dev
Dev
- Loading branch information
Showing
10 changed files
with
247 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import React from "react"; | ||
import { render, screen } from "@testing-library/react"; | ||
import { describe, it, expect } from "vitest"; | ||
import GrowthCircle from "@/components/GrowthCircle"; | ||
|
||
describe("GrowthCircle Component", () => { | ||
/* | ||
Adrian Alejandro Ramirez Cruz A00830640 - Test #6/12 | ||
Test #1: Verifica que el componente se renderiza correctamente con los valores mínimos. | ||
*/ | ||
it("renders correctly with minimum values", () => { | ||
render( | ||
<GrowthCircle | ||
percentage={0} | ||
gradient={{ start: "#000000", end: "#ffffff" }} | ||
/>, | ||
); | ||
const svgElement = screen.getByTestId("growth-circle-svg"); | ||
expect(svgElement).toBeInTheDocument(); | ||
}); | ||
|
||
/* | ||
Adrian Alejandro Ramirez Cruz A00830640 - Test #7/12 | ||
Test #2: Verifica que el componente se renderiza correctamente con los valores máximos. | ||
*/ | ||
it("renders correctly with maximum values", () => { | ||
render( | ||
<GrowthCircle | ||
percentage={100} | ||
gradient={{ start: "#000000", end: "#ffffff" }} | ||
/>, | ||
); | ||
const svgElement = screen.getByTestId("growth-circle-svg"); | ||
expect(svgElement).toBeInTheDocument(); | ||
}); | ||
|
||
/* | ||
Adrian Alejandro Ramirez Cruz A00830640 - Test #8/12 | ||
Test #3: Verifica que el tamaño del círculo y el radio se calculan correctamente. | ||
*/ | ||
it("calculates the circle size and radius correctly", () => { | ||
render( | ||
<GrowthCircle | ||
percentage={50} | ||
gradient={{ start: "#000000", end: "#ffffff" }} | ||
/>, | ||
); | ||
const svgElement = screen.getByTestId("growth-circle-svg"); | ||
const circleElement = screen.getByTestId("growth-circle"); | ||
const expectedRadius = 50; // 50% of the maxSize (150) | ||
expect(svgElement).toHaveAttribute("width", String(expectedRadius * 2)); | ||
expect(svgElement).toHaveAttribute("height", String(expectedRadius * 2)); | ||
expect(circleElement).toHaveAttribute("r", String(expectedRadius)); | ||
}); | ||
|
||
/* | ||
Adrian Alejandro Ramirez Cruz A00830640 - Test #9/10 | ||
Test #4: Verifica que el texto se renderiza correctamente dentro del círculo. | ||
*/ | ||
it("renders text correctly inside the circle", () => { | ||
render( | ||
<GrowthCircle | ||
percentage={75} | ||
gradient={{ start: "#000000", end: "#ffffff" }} | ||
/>, | ||
); | ||
const textElement = screen.getByText("75%"); | ||
expect(textElement).toBeInTheDocument(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import React from "react"; | ||
import { render, screen } from "@testing-library/react"; | ||
import { describe, it, expect } from "vitest"; | ||
import Loader from "@/components/Loader"; | ||
|
||
describe("Loader Component", () => { | ||
/* | ||
Adrian Alejandro Ramirez Cruz A00830640 - Test #10/12 | ||
Test #1: Verifica que el componente se renderiza correctamente. | ||
*/ | ||
it("renders correctly", () => { | ||
render(<Loader />); | ||
const loaderSection = screen.getByTestId("loader-section"); | ||
expect(loaderSection).toBeInTheDocument(); | ||
}); | ||
|
||
/* | ||
Adrian Alejandro Ramirez Cruz A00830640 - Test #11/12 | ||
Test #2: Verifica que el contenedor y las cajas se renderizan correctamente. | ||
*/ | ||
it("renders the loader container and boxes correctly", () => { | ||
render(<Loader />); | ||
const loaderContainer = screen.getByTestId("loader-container"); | ||
const loaderBoxes = screen.getAllByTestId("loader-box"); | ||
expect(loaderContainer).toBeInTheDocument(); | ||
expect(loaderBoxes.length).toBe(5); // Verifica que haya 5 elementos con el data-testid "loader-box" | ||
}); | ||
|
||
/* | ||
Adrian Alejandro Ramirez Cruz A00830640 - Test #12/12 | ||
Test #3: Verifica que el texto de carga se renderiza correctamente. | ||
*/ | ||
it("renders the loading text correctly", () => { | ||
render(<Loader />); | ||
const loadingText = screen.getByTestId("loader-text"); | ||
expect(loadingText).toBeInTheDocument(); | ||
expect(loadingText).toHaveTextContent("Cargando..."); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import React from "react"; | ||
import { render, screen } from "@testing-library/react"; | ||
import { describe, it, expect } from "vitest"; | ||
import UserProfileButton from "@/components/UserProfileButton"; | ||
|
||
describe("UserProfileButton Component", () => { | ||
/* | ||
Adrian Alejandro Ramirez Cruz A00830640 - Test #1/12 | ||
Test #1: Verifica que el componente se renderiza correctamente sin una foto de perfil. | ||
*/ | ||
it("renders correctly without a profile photo", () => { | ||
render(<UserProfileButton />); | ||
expect(screen.getByTestId("user-profile-icon")).toBeInTheDocument(); | ||
}); | ||
|
||
/* | ||
Adrian Alejandro Ramirez Cruz A00830640 - Test #2/12 | ||
Test #2: Verifica que el componente se renderiza correctamente con una foto de perfil. | ||
*/ | ||
it("renders correctly with a profile photo", () => { | ||
const photoUrl = "https://example.com/photo.jpg"; | ||
render(<UserProfileButton photoUrl={photoUrl} />); | ||
const imgElement = screen.getByAltText("User"); | ||
expect(imgElement).toBeInTheDocument(); | ||
expect(imgElement).toHaveAttribute("src", photoUrl); | ||
}); | ||
|
||
/* | ||
Adrian Alejandro Ramirez Cruz A00830640 - Test #3/12 | ||
Test #3: Verifica que el componente se renderiza con el tamaño especificado. | ||
*/ | ||
it("renders with the specified size", () => { | ||
render(<UserProfileButton size="lg" />); | ||
const svgElement = screen.getByTestId("user-profile-icon"); | ||
expect(svgElement).toHaveClass("h-32 w-32"); | ||
}); | ||
|
||
/* | ||
Adrian Alejandro Ramirez Cruz A00830640 - Test #4/12 | ||
Test #4: Verifica que el componente se renderiza con el color por defecto. | ||
*/ | ||
it("renders with default color", () => { | ||
render(<UserProfileButton />); | ||
const svgElement = screen.getByTestId("user-profile-icon"); | ||
expect(svgElement).toHaveClass("text-primary"); | ||
}); | ||
|
||
/* | ||
Adrian Alejandro Ramirez Cruz A00830640 - Test #5/12 | ||
Test #5: Verifica que el componente se renderiza con el color personalizado. | ||
*/ | ||
it("renders with custom color", () => { | ||
render(<UserProfileButton color="text-secondary" />); | ||
const svgElement = screen.getByTestId("user-profile-icon"); | ||
expect(svgElement).toHaveClass("text-secondary"); | ||
}); | ||
}); |