From ad4cc56546fb314c1aad3657d2761bf0e08be5e8 Mon Sep 17 00:00:00 2001 From: Groom Book CTO Date: Thu, 19 Mar 2026 03:20:09 +0000 Subject: [PATCH] Fix brand text test to handle split-element rendering The nav brand was changed to GroomBook for color styling, but getByText with a regex can't match text split across child elements. Use a custom text matcher that checks the STRONG element's textContent. Co-Authored-By: Paperclip --- apps/web/src/__tests__/App.test.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/web/src/__tests__/App.test.tsx b/apps/web/src/__tests__/App.test.tsx index 47b9656..0052984 100644 --- a/apps/web/src/__tests__/App.test.tsx +++ b/apps/web/src/__tests__/App.test.tsx @@ -23,7 +23,9 @@ function renderApp(route = "/admin") { describe("App navigation", () => { it("renders the Groom Book brand", () => { const nav = renderApp(); - expect(within(nav).getByText(/Groom\s*Book/)).toBeInTheDocument(); + expect( + within(nav).getByText((_, el) => el?.tagName === "STRONG" && /Groom\s*Book/.test(el.textContent ?? "")) + ).toBeInTheDocument(); }); it("renders the Book CTA button", () => { @@ -61,6 +63,8 @@ describe("App navigation", () => { ); // Customer portal should render at root - no admin nav present - expect(screen.queryByText(/Groom\s*Book/)).not.toBeInTheDocument(); + expect( + screen.queryByText((_, el) => el?.tagName === "STRONG" && /Groom\s*Book/.test(el.textContent ?? "")) + ).not.toBeInTheDocument(); }); });