mirror of
https://github.com/stablyai/orca.git
synced 2026-10-31 17:17:38 +00:00
test: remove 56 low-value cases and 5 suites (#34268)
Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
This commit is contained in:
@@ -1,27 +0,0 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { isMutablePRConversationComment } from './pr-comment-mutability'
|
||||
|
||||
describe('isMutablePRConversationComment', () => {
|
||||
it('allows top-level conversation comments but not review threads or summaries', () => {
|
||||
expect(
|
||||
isMutablePRConversationComment({
|
||||
id: 12,
|
||||
url: 'https://github.com/acme/widgets/pull/42#issuecomment-12'
|
||||
})
|
||||
).toBe(true)
|
||||
expect(
|
||||
isMutablePRConversationComment({
|
||||
id: 34,
|
||||
url: 'https://github.com/acme/widgets/pull/42#discussion_r34',
|
||||
threadId: 'thread-1',
|
||||
path: 'src/a.ts'
|
||||
})
|
||||
).toBe(false)
|
||||
expect(
|
||||
isMutablePRConversationComment({
|
||||
id: 99,
|
||||
url: 'https://github.com/acme/widgets/pull/42#pullrequestreview-99'
|
||||
})
|
||||
).toBe(false)
|
||||
})
|
||||
})
|
||||
@@ -3,10 +3,7 @@ import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||
import type { GitHubWorkItem } from './work-item-types'
|
||||
import {
|
||||
GITHUB_PR_REVIEWER_INPUT_MAX_BYTES,
|
||||
getGitHubPRPrimaryReviewer,
|
||||
getGitHubPRReviewerRows,
|
||||
getGitHubPRReviewLabel,
|
||||
normalizeGitHubReviewerLogins,
|
||||
parseGitHubReviewerInputLogins
|
||||
} from './pr-reviewer-display'
|
||||
|
||||
@@ -19,69 +16,6 @@ afterEach(() => {
|
||||
})
|
||||
|
||||
describe('GitHub PR reviewer display', () => {
|
||||
it('shows the requested reviewer instead of a request count', () => {
|
||||
expect(
|
||||
getGitHubPRReviewLabel(
|
||||
item({
|
||||
reviewRequests: [{ login: 'ExampleReviewer', name: null, avatarUrl: '' }]
|
||||
})
|
||||
)
|
||||
).toBe('ExampleReviewer')
|
||||
})
|
||||
|
||||
it('keeps multiple reviewers compact while still naming the first reviewer', () => {
|
||||
expect(
|
||||
getGitHubPRReviewLabel(
|
||||
item({
|
||||
reviewRequests: [
|
||||
{ login: 'ExampleReviewer', name: null, avatarUrl: '' },
|
||||
{ login: 'agent-slack', name: null, avatarUrl: '' },
|
||||
{ login: 'stably', name: null, avatarUrl: '' }
|
||||
]
|
||||
})
|
||||
)
|
||||
).toBe('ExampleReviewer +2')
|
||||
})
|
||||
|
||||
it('preserves stronger review decision labels', () => {
|
||||
expect(
|
||||
getGitHubPRReviewLabel(
|
||||
item({
|
||||
reviewDecision: 'APPROVED',
|
||||
reviewRequests: [{ login: 'ExampleReviewer', name: null, avatarUrl: '' }]
|
||||
})
|
||||
)
|
||||
).toBe('Approved')
|
||||
})
|
||||
|
||||
it('falls back to reviewed users and empty metadata labels', () => {
|
||||
expect(getGitHubPRReviewLabel(item({ latestReviews: [{ login: 'reviewer' }] }))).toBe(
|
||||
'reviewer'
|
||||
)
|
||||
expect(getGitHubPRReviewLabel(item({ reviewRequests: [] }))).toBe('No reviewers')
|
||||
expect(getGitHubPRReviewLabel(item({}))).toBe('Reviewers')
|
||||
})
|
||||
|
||||
it('returns the primary reviewer avatar without requiring another lookup', () => {
|
||||
expect(
|
||||
getGitHubPRPrimaryReviewer(
|
||||
item({
|
||||
reviewRequests: [
|
||||
{
|
||||
login: 'ExampleReviewer',
|
||||
name: null,
|
||||
avatarUrl: 'https://avatars.githubusercontent.com/u/1?v=4'
|
||||
}
|
||||
]
|
||||
})
|
||||
)
|
||||
).toEqual({
|
||||
login: 'ExampleReviewer',
|
||||
name: null,
|
||||
avatarUrl: 'https://avatars.githubusercontent.com/u/1?v=4'
|
||||
})
|
||||
})
|
||||
|
||||
it('builds reviewer rows for requested and reviewed users', () => {
|
||||
expect(
|
||||
getGitHubPRReviewerRows(
|
||||
@@ -109,15 +43,6 @@ describe('GitHub PR reviewer display', () => {
|
||||
])
|
||||
})
|
||||
|
||||
it('normalizes reviewer input before sending it to GitHub', () => {
|
||||
expect(
|
||||
normalizeGitHubReviewerLogins(
|
||||
[' @ExampleReviewer ', 'examplereviewer', '@new-reviewer'],
|
||||
new Set(['existing'])
|
||||
)
|
||||
).toEqual(['ExampleReviewer', 'new-reviewer'])
|
||||
})
|
||||
|
||||
it('parses pasted reviewer input without regex splitting', () => {
|
||||
const split = vi.spyOn(String.prototype, 'split')
|
||||
const input = ['@ExampleReviewer,', String.fromCharCode(160), '@new-reviewer\nthird'].join('')
|
||||
|
||||
Reference in New Issue
Block a user