diff --git a/gui/src/components/UnifiedTerminal/UnifiedTerminal.test.tsx b/gui/src/components/UnifiedTerminal/UnifiedTerminal.test.tsx index 55420628fc9..e6ea5eea8ff 100644 --- a/gui/src/components/UnifiedTerminal/UnifiedTerminal.test.tsx +++ b/gui/src/components/UnifiedTerminal/UnifiedTerminal.test.tsx @@ -27,7 +27,8 @@ const MOCK_ANSI_OUTPUT = `\u001b[32m✓\u001b[0m Test passed const MOCK_OUTPUT_WITH_LINKS = `Build successful! Visit https://example.com for more info Check www.github.com/user/repo -Error logs at file:///tmp/error.log`; +Error logs at file:///tmp/error.log +Available on: http://192.168.137.1:8081`; // Mock the redux hooks const mockDispatch = vi.fn(); @@ -200,9 +201,13 @@ describe("UnifiedTerminalCommand", () => { // Should contain the link text in the output expect(container.textContent).toMatch(/https:\/\/example\.com/); expect(container.textContent).toMatch(/www\.github\.com/); + expect(container.textContent).toMatch(/http:\/\/192\.168\.137\.1:8081/); - // Note: Link detection might create actual tags or just display the URLs - // The important thing is the URLs are visible in the output + // Verify rendered links have correct hrefs including port + const links = container.querySelectorAll("a"); + const hrefs = Array.from(links).map((a) => a.getAttribute("href")); + expect(hrefs).toContainEqual("https://example.com"); + expect(hrefs).toContainEqual(expect.stringContaining("192.168.137.1:8081")); }); test("shows copy and run in terminal buttons when not running", async () => { diff --git a/gui/src/components/UnifiedTerminal/UnifiedTerminal.tsx b/gui/src/components/UnifiedTerminal/UnifiedTerminal.tsx index f048af8fb36..34e72584ab6 100644 --- a/gui/src/components/UnifiedTerminal/UnifiedTerminal.tsx +++ b/gui/src/components/UnifiedTerminal/UnifiedTerminal.tsx @@ -175,8 +175,7 @@ function convertBundleIntoReact( } const content: React.ReactNode[] = []; - const linkRegex = - /(\s|^)(https?:\/\/(?:www\.|(?!www))[^\s.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})/g; + const linkRegex = /(\s|^)(https?:\/\/[^\s]+|www\.[^\s]+\.[^\s]{2,})/g; let index = 0; let match: RegExpExecArray | null;