diff --git a/src/__tests__/home-listing-section.claw591.test.tsx b/src/__tests__/home-listing-section.claw591.test.tsx index 1537cdde..e906557b 100644 --- a/src/__tests__/home-listing-section.claw591.test.tsx +++ b/src/__tests__/home-listing-section.claw591.test.tsx @@ -78,7 +78,7 @@ describe("HomeListingSection", () => { fetchCanonicalTrendingPageMock.mockResolvedValue(canonicalPage([])); }); - it("defaults the homepage to Skills and canonical Trending with exact tab order", () => { + it("labels canonical Trending values as downloads without changing order or values", () => { const first = makeTrending("first", "First Skill", 17, 9000); const second = makeTrending("second", "Second Skill", 3, 8000); render(); @@ -112,9 +112,16 @@ describe("HomeListingSection", () => { ).toEqual(["First Skill", "Second Skill"]); expect(screen.getByText("17")).toBeTruthy(); expect(screen.getByText("3")).toBeTruthy(); + expect(screen.getByText("24h downloads")).toBeTruthy(); + expect(screen.getAllByLabelText("24-hour downloads")).toHaveLength(2); + expect(screen.queryByText("24h installs")).toBeNull(); + expect(screen.queryByLabelText("24-hour installs")).toBeNull(); expect(screen.queryByText("9K")).toBeNull(); expect(screen.queryByText("8K")).toBeNull(); expect(screen.queryByText("skills.sh")).toBeNull(); + + fireEvent.click(screen.getByRole("button", { name: "Grid view" })); + expect(screen.getAllByLabelText("24-hour downloads")).toHaveLength(2); }); it("hides unavailable Trending and falls back to the Featured feed", async () => { diff --git a/src/__tests__/skills-index.claw591.test.tsx b/src/__tests__/skills-index.claw591.test.tsx index e930e6f1..5436f379 100644 --- a/src/__tests__/skills-index.claw591.test.tsx +++ b/src/__tests__/skills-index.claw591.test.tsx @@ -110,7 +110,7 @@ describe("SkillsIndex", () => { expect(screen.queryByLabelText("Skill categories")).toBeNull(); }); - it("renders canonical Trending rows in API order with only 24-hour installs", async () => { + it("labels canonical Trending rows as downloads without changing API order or values", async () => { fetchCanonicalTrendingPageMock.mockResolvedValue( canonicalPage([ makeTrending("first", "First Skill", 17, 9000), @@ -120,7 +120,7 @@ describe("SkillsIndex", () => { render(); - expect(await screen.findByTitle("First Skill")).toBeTruthy(); + expect(await screen.findByText("First Skill")).toBeTruthy(); const names = Array.from( document.querySelectorAll(".skill-list-item-name"), (node) => node.textContent, @@ -128,12 +128,29 @@ describe("SkillsIndex", () => { expect(names).toEqual(["First Skill", "Second Skill"]); expect(screen.getByText("17")).toBeTruthy(); expect(screen.getByText("3")).toBeTruthy(); + expect(screen.getByText("24h downloads")).toBeTruthy(); + expect(screen.getAllByLabelText("24-hour downloads")).toHaveLength(2); + expect(screen.queryByText("24h installs")).toBeNull(); + expect(screen.queryByLabelText("24-hour installs")).toBeNull(); expect(screen.queryByText("9K")).toBeNull(); expect(screen.queryByText("8K")).toBeNull(); expect(screen.queryByText("skills.sh")).toBeNull(); expect(screen.queryByText(/Not scanned by ClawHub/i)).toBeNull(); }); + it("labels canonical Trending grid cards as downloads", async () => { + searchMock = { view: "grid" }; + fetchCanonicalTrendingPageMock.mockResolvedValue( + canonicalPage([makeTrending("first", "First Skill", 17, 9000)]), + ); + + render(); + + expect(await screen.findByText("First Skill")).toBeTruthy(); + expect(screen.getByLabelText("24-hour downloads").textContent).toContain("17"); + expect(screen.queryByLabelText("24-hour installs")).toBeNull(); + }); + it("hides disabled Trending and falls back to the Featured feed", async () => { fetchCatalogDiscoveryCapabilitiesMock.mockResolvedValue({ apiVersion: 0, diff --git a/src/components/HomeListingSection.tsx b/src/components/HomeListingSection.tsx index dcedf4cc..d6439a61 100644 --- a/src/components/HomeListingSection.tsx +++ b/src/components/HomeListingSection.tsx @@ -220,7 +220,7 @@ function HomeListingSkillRow({ entry, showStats }: { entry: SkillPageEntry; show

{typeof item.metrics.trending24hInstalls === "number" ? ( -
+