Files
orca/src/main/github/comment-reactions.test.ts
T
6233b8e8a4 feat: Add GitHub PR review workflow to tasks (#1172)
* Render GitHub markdown safely

Co-authored-by: Orca <help@stably.ai>

* Support PR line comment ranges in diffs

Co-authored-by: Orca <help@stably.ai>

* Add GitHub item dialog review workflow

Co-authored-by: Orca <help@stably.ai>

* Make attribution tests environment-safe

Co-authored-by: Orca <help@stably.ai>

* Wire GitHubItemDialog for row clicks and bound file cache

Row clicks in the Tasks GitHub list now open the new GitHubItemDialog
instead of the legacy GitHubItemDrawer, making the PR review workflow
reachable from the main entry point. The unused drawer and its state
are removed.

Also bounds prFileContentCache at 64 entries with LRU eviction so the
module-level map can no longer grow without limit across many PR
openings in a session.

Co-authored-by: Orca <help@stably.ai>

* Convert GitHubItemDialog to a right-side drawer

Replaces the centered Dialog modal with a Sheet drawer (side=right,
max-w 960/1100/1280 across breakpoints) so the review surface slides
in from the side instead of popping over the task list.

Co-authored-by: Orca <help@stably.ai>

* Address review feedback on GitHub work-item details

- Restore full pagination in listAssignableUsers (REST /assignees --paginate)
  so repos with >100 assignees no longer silently drop users from the picker.
- Drop redundant REST /users/<login> fan-out in getMentionParticipants; the
  aliased GraphQL query already returns login/name/avatarUrl.
- Parallelize mention-participant lookup with checks/participants fetch.
- Avoid mutating caller-provided objects in mergeGitHubUsers.
- Type addIssueComment / addPRReviewComment(Reply) preload wrappers as
  Promise<GitHubCommentResult> instead of Promise<unknown>.
- Use typeof startLine === 'number' to harden the review-comment guard.

Co-authored-by: Orca <help@stably.ai>

---------

Co-authored-by: Orca <help@stably.ai>
Co-authored-by: Jinjing <6427696+AmethystLiang@users.noreply.github.com>
2026-04-28 00:11:39 -07:00

26 lines
828 B
TypeScript

import { describe, expect, it } from 'vitest'
import { mapGraphQLReactionGroups } from './comment-reactions'
describe('mapGraphQLReactionGroups', () => {
it('normalizes GraphQL reaction groups into GitHub comment reactions', () => {
expect(
mapGraphQLReactionGroups([
{ content: 'EYES', reactors: { totalCount: 1 } },
{ content: 'THUMBS_UP', reactors: { totalCount: 2 } },
{ content: 'HEART', reactors: { totalCount: 0 } },
{ content: 'UNKNOWN', reactors: { totalCount: 9 } }
])
).toEqual([
{ content: '+1', count: 2 },
{ content: 'eyes', count: 1 }
])
})
it('returns undefined when there are no visible reactions', () => {
expect(mapGraphQLReactionGroups([{ content: 'ROCKET', reactors: { totalCount: 0 } }])).toBe(
undefined
)
})
})