mirror of
https://github.com/OpenHands/OpenHands.git
synced 2025-12-26 05:48:36 +08:00
This adds a new page to the OpenHands frontend for managing GitHub issues and pull requests. The page allows users to: 1. View issues and PRs from their connected GitHub account 2. Filter by type (issues, PRs, or all) 3. Filter by assignment (assigned to me, authored by me) 4. Start a new session to work on an issue or PR 5. Resume an existing session if one is already working on that item Features: - View type selector (All/Issues/Pull Requests) - Filter checkboxes for 'assigned to me' and 'authored by me' - Local storage caching with 1-minute refresh interval - Manual refresh button - Start Session button to create a new conversation for an issue/PR - Resume Session button to continue an existing conversation - Status badges showing item state (Open Issue, Open PR, etc.) - Links to view items on GitHub Technical implementation: - New route at /github-issues-prs - API service using existing /api/user/suggested-tasks endpoint - React Query hook with localStorage caching - Sidebar navigation button - Comprehensive unit tests (24 tests) - i18n translations for all UI text Co-authored-by: openhands <openhands@all-hands.dev>
77 lines
2.0 KiB
TypeScript
77 lines
2.0 KiB
TypeScript
import { describe, it, expect } from "vitest";
|
|
import GitHubIssuesPRsService from "../../src/api/github-service/github-issues-prs.api";
|
|
|
|
describe("GitHubIssuesPRsService", () => {
|
|
describe("buildItemUrl", () => {
|
|
it("should build correct GitHub issue URL", () => {
|
|
const url = GitHubIssuesPRsService.buildItemUrl(
|
|
"github",
|
|
"owner/repo",
|
|
123,
|
|
"issue",
|
|
);
|
|
expect(url).toBe("https://github.com/owner/repo/issues/123");
|
|
});
|
|
|
|
it("should build correct GitHub PR URL", () => {
|
|
const url = GitHubIssuesPRsService.buildItemUrl(
|
|
"github",
|
|
"owner/repo",
|
|
456,
|
|
"pr",
|
|
);
|
|
expect(url).toBe("https://github.com/owner/repo/pull/456");
|
|
});
|
|
|
|
it("should build correct GitLab issue URL", () => {
|
|
const url = GitHubIssuesPRsService.buildItemUrl(
|
|
"gitlab",
|
|
"owner/repo",
|
|
123,
|
|
"issue",
|
|
);
|
|
expect(url).toBe("https://gitlab.com/owner/repo/-/issues/123");
|
|
});
|
|
|
|
it("should build correct GitLab MR URL", () => {
|
|
const url = GitHubIssuesPRsService.buildItemUrl(
|
|
"gitlab",
|
|
"owner/repo",
|
|
456,
|
|
"pr",
|
|
);
|
|
expect(url).toBe("https://gitlab.com/owner/repo/-/merge_requests/456");
|
|
});
|
|
|
|
it("should build correct Bitbucket issue URL", () => {
|
|
const url = GitHubIssuesPRsService.buildItemUrl(
|
|
"bitbucket",
|
|
"owner/repo",
|
|
123,
|
|
"issue",
|
|
);
|
|
expect(url).toBe("https://bitbucket.org/owner/repo/issues/123");
|
|
});
|
|
|
|
it("should build correct Bitbucket PR URL", () => {
|
|
const url = GitHubIssuesPRsService.buildItemUrl(
|
|
"bitbucket",
|
|
"owner/repo",
|
|
456,
|
|
"pr",
|
|
);
|
|
expect(url).toBe("https://bitbucket.org/owner/repo/pull-requests/456");
|
|
});
|
|
|
|
it("should return empty string for unknown provider", () => {
|
|
const url = GitHubIssuesPRsService.buildItemUrl(
|
|
"unknown" as any,
|
|
"owner/repo",
|
|
123,
|
|
"issue",
|
|
);
|
|
expect(url).toBe("");
|
|
});
|
|
});
|
|
});
|