Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions gui/src/components/UnifiedTerminal/UnifiedTerminal.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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 <a> 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 () => {
Expand Down
3 changes: 1 addition & 2 deletions gui/src/components/UnifiedTerminal/UnifiedTerminal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading