Testing GitHub URL Parser Implementation in OpenHands
This test suite validates the GitHub URL parsing functionality in the OpenHands repository. It ensures accurate extraction of username and repository components from GitHub URLs through comprehensive unit testing.
Test Coverage Overview
Implementation Analysis
Technical Details
Best Practices Demonstrated
all-hands-ai/openhands
frontend/__tests__/utils/parse-github-url.test.ts
import { expect, test } from "vitest";
import { parseGithubUrl } from "../../src/utils/parse-github-url";
test("parseGithubUrl", () => {
expect(
parseGithubUrl("https://github.com/alexreardon/tiny-invariant"),
).toEqual(["alexreardon", "tiny-invariant"]);
expect(parseGithubUrl("https://github.com/All-Hands-AI/OpenHands")).toEqual([
"All-Hands-AI",
"OpenHands",
]);
expect(parseGithubUrl("https://github.com/All-Hands-AI/")).toEqual([
"All-Hands-AI",
"",
]);
expect(parseGithubUrl("https://github.com/")).toEqual([]);
});