fix(home): arredondar para baixo o 'Mais de N' dos projetos do GitHub

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
Evandro Fonseca JuniorandClaude Sonnet 5.5 committed 2026-10-08 10:28:00 -03:00
1 parent 0350e7e883
commit 168ee9a180
2 files changed
+26 -4

No files matched your search

+18 -2
View File
@@ -1,7 +1,7 @@
import { fireEvent, render, screen } from "@testing-library/react";
import type { ReactNode } from "react";
import Hero from "./Hero";
import Hero, { roundedRepoFloor } from "./Hero";
jest.mock("motion/react", () => {
const React = require("react");
@@ -87,11 +87,27 @@ describe("Hero", () => {
expect(screen.getByText("projetos desenvolvidos")).toBeInTheDocument();
expect(screen.getByText("Mais de")).toBeInTheDocument();
expect(screen.getByText("68")).toBeInTheDocument();
expect(screen.getByText("65")).toBeInTheDocument();
expect(screen.getByText("25 públicos · 43 privados")).toBeInTheDocument();
expect(screen.queryByText(/projetos publicados/i)).not.toBeInTheDocument();
});
it("rounds the repo count down so 'mais de' is always true", () => {
expect(roundedRepoFloor(68)).toBe(65);
expect(roundedRepoFloor(66)).toBe(65);
expect(roundedRepoFloor(65)).toBe(60);
expect(roundedRepoFloor(6)).toBe(5);
expect(roundedRepoFloor(5)).toBe(0);
});
it("hides the repo count while the total is too small to round", () => {
render(<Hero stats={{ repos: { total: 4, public: 2, private: 2 } }} />);
expect(
screen.queryByText(/projetos desenvolvidos/i),
).not.toBeInTheDocument();
});
it("omits the repo count when the GitHub lookup is unavailable", () => {
render(<Hero stats={{ years: 5 }} />);