mirror of
https://github.com/stablyai/orca.git
synced 2026-09-29 16:02:50 +00:00
* refactor(tests): split oversized test files off the max-lines suppression list Every `*.test.ts`/`*.spec.ts` that carried an `eslint/oxlint-disable max-lines` directive is now split into focused, behavior-scoped suites that fit the 800-line test budget, with shared setup extracted into co-located `*-test-harness.ts` / `*-test-fixtures.ts` modules (300-line budget). 83 files became ~930; the largest output is 797 effective lines. `orca-runtime.test.ts` is intentionally untouched. Test bodies were moved by scripted line-range slicing rather than retyped, so assertions are byte-identical. The only permitted body edits were mechanical rebinding where a shared value moved into a harness (e.g. `tmpHome` -> `homes.tmpHome`). Registries that enumerate test files were updated in lockstep: - config/max-lines-baseline.txt: pruned 341 -> 258 entries (all 83 removed). - config/reliability-gates.jsonc: 33 gates repointed at the split files, with assertionRefs split per file where a gate's coverage now spans several. - .github/workflows/pr.yml: the real-zsh lane now lists the 4 split files that actually exercise zsh, so they keep running in the dedicated shell lane. Also renamed agent-hooks `server-test-fixtures.ts` to `server.test-fixtures.ts` so the global-fetch call-site audit keeps skipping it, and added `.js` extensions to the CLI suites' dynamic harness imports (node16 resolution) to unbreak `build:cli`. Verification: full suite 52,449 passing vs 52,448 at baseline with zero assertions lost; `pnpm lint`, `pnpm typecheck`, and `pnpm build:cli` all exit 0; the terminal-pane e2e spec runs 31/31 headless. * refactor(tests): split hook-idle arbitration suite that oxfmt pushed over budget The pre-commit oxfmt pass reflowed pty-connection-hook-idle-arbitration.test.ts to 811 effective lines, 11 over the test budget. Split the hook-completion side effect and replacement-agent veto cases into their own suite; both files now sit well under the cap and the 15 tests are unchanged. * test: port upstream test changes into the split files after rebase Rebasing onto main surfaced 27 tests that main had added to files this branch deleted, plus edits to tests that had already moved. Taking the deletion side of those modify/delete conflicts would have dropped that coverage silently, so each upstream change is ported into the split file that now owns the behavior — for example main's six orchestration mailbox tests land across orchestration-runs, -send, and -check. Also repoints `orchestration.notification-mailbox-consistency`, a gate main added after this branch's gate remap, at those same three split files, and re-prunes the max-lines baseline against main's (257 entries). Verified: all 27 upstream test titles present; full suite 52,761 passing with the only diff vs baseline being 12 tests main itself removed and 3 that moved from skipped to passing; lint and typecheck exit 0. * fix(test): flush pending continuations before tearing down terminal test globals CI shard 5/16 failed on both Node 24 and 26 with `ReferenceError: window is not defined` from pty-connection.ts, surfacing through pty-connection-daemon-snapshot-replay.test.ts. The reattach/settle chains `await` a real promise and then touch `window.api`. Under fake timers those continuations cannot run, so they only become schedulable once restoreTerminalTestGlobals() switches back to real timers — which previously happened immediately before `delete globalThis.window`, so a late continuation threw and failed the whole file. Flush async ticks in that window instead. This is latent in the source rather than new: the pre-split 25k-line file kept running other tests after these, which gave the chains time to settle before teardown. Splitting the file moved teardown directly behind them. * fix(test): keep an inert window after terminal test teardown instead of deleting it The async-tick flush was not enough: the reattach/settle chain can resolve after teardown regardless of how long we drain, so CI shard 5/16 still failed with `ReferenceError: window is not defined` from pty-connection.ts. A real renderer never loses `window`, so deleting it was the artificial part. Swap in an inert proxy whose properties resolve to callables and whose calls resolve to undefined, making a late `window.api.pty.*` call a harmless no-op. The next test replaces it wholesale via installTerminalTestGlobals(), and no test asserts that `window` is absent.
466 lines
16 KiB
TypeScript
466 lines
16 KiB
TypeScript
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
|
import type * as GithubApiRepositoryModule from './github-api-repository'
|
|
import type * as GitHubEnterpriseRepositoryModule from './github-enterprise-repository'
|
|
|
|
const { clientMocks, moduleMocks } = await vi.hoisted(async () => {
|
|
const moduleMocks = await import('./client-test-mocks')
|
|
return { clientMocks: moduleMocks.createGitHubClientMocks(), moduleMocks }
|
|
})
|
|
|
|
vi.mock('./gh-utils', () => moduleMocks.ghUtilsModuleMock(clientMocks))
|
|
vi.mock('../git/runner', () => moduleMocks.gitRunnerModuleMock(clientMocks))
|
|
vi.mock('../providers/ssh-git-dispatch', () => moduleMocks.sshGitDispatchModuleMock(clientMocks))
|
|
vi.mock('./local-git-config-signature', () =>
|
|
moduleMocks.localGitConfigSignatureModuleMock(clientMocks)
|
|
)
|
|
vi.mock('./github-enterprise-repository', async (importOriginal) =>
|
|
moduleMocks.githubEnterpriseRepositoryModuleMock(
|
|
await importOriginal<typeof GitHubEnterpriseRepositoryModule>()
|
|
)
|
|
)
|
|
vi.mock('./rate-limit', () => moduleMocks.rateLimitModuleMock(clientMocks))
|
|
vi.mock('./github-api-repository', async (importOriginal) =>
|
|
moduleMocks.githubApiRepositoryModuleMock(
|
|
clientMocks,
|
|
await importOriginal<typeof GithubApiRepositoryModule>()
|
|
)
|
|
)
|
|
|
|
import { getRepoSlug, getRepoUpstream, getWorkItem, getPullRequestPushTarget } from './client'
|
|
import { resetPRForBranchMocks } from './client-test-harness'
|
|
|
|
const {
|
|
ghExecFileAsyncMock,
|
|
getOwnerRepoMock,
|
|
getOwnerRepoForRemoteMock,
|
|
resolvePRRepositoryCandidatesMock,
|
|
getRemoteUrlForRepoMock,
|
|
gitExecFileAsyncMock
|
|
} = clientMocks
|
|
|
|
describe('getPRForBranch', () => {
|
|
beforeEach(() => {
|
|
resetPRForBranchMocks(clientMocks)
|
|
})
|
|
|
|
it('resolves fork PR push target using the origin URL protocol', async () => {
|
|
getOwnerRepoMock.mockResolvedValueOnce({ owner: 'stablyai', repo: 'orca' })
|
|
getOwnerRepoForRemoteMock.mockResolvedValueOnce({ owner: 'stablyai', repo: 'orca' })
|
|
ghExecFileAsyncMock.mockResolvedValueOnce({
|
|
stdout: JSON.stringify({
|
|
head: {
|
|
ref: 'prateek/fix-sidebar-agents-toggle',
|
|
repo: {
|
|
full_name: 'prateek/orca',
|
|
name: 'orca',
|
|
clone_url: 'https://github.com/prateek/orca.git',
|
|
ssh_url: 'git@github.com:prateek/orca.git',
|
|
owner: { login: 'prateek' }
|
|
}
|
|
}
|
|
})
|
|
})
|
|
getRemoteUrlForRepoMock.mockResolvedValueOnce('git@github.com:stablyai/orca.git')
|
|
|
|
const target = await getPullRequestPushTarget('/repo-root', 1738)
|
|
|
|
expect(ghExecFileAsyncMock).toHaveBeenCalledWith(['api', 'repos/stablyai/orca/pulls/1738'], {
|
|
cwd: '/repo-root'
|
|
})
|
|
expect(target).toEqual({
|
|
pushTarget: {
|
|
remoteName: 'pr-prateek-orca',
|
|
branchName: 'prateek/fix-sidebar-agents-toggle',
|
|
remoteUrl: 'git@github.com:prateek/orca.git'
|
|
}
|
|
})
|
|
})
|
|
|
|
it('pins explicit origin push-target lookup when upstream has the same PR number', async () => {
|
|
getOwnerRepoMock.mockResolvedValue({ owner: 'fork', repo: 'orca' })
|
|
resolvePRRepositoryCandidatesMock.mockResolvedValue({
|
|
candidates: [
|
|
{ owner: 'upstream', repo: 'orca' },
|
|
{ owner: 'fork', repo: 'orca' }
|
|
],
|
|
headRepo: { owner: 'fork', repo: 'orca' }
|
|
})
|
|
ghExecFileAsyncMock.mockResolvedValueOnce({
|
|
stdout: JSON.stringify({
|
|
head: {
|
|
ref: 'contributor/fix',
|
|
repo: {
|
|
full_name: 'contributor/orca',
|
|
name: 'orca',
|
|
clone_url: 'https://github.com/contributor/orca.git',
|
|
ssh_url: 'git@github.com:contributor/orca.git',
|
|
owner: { login: 'contributor' }
|
|
}
|
|
}
|
|
})
|
|
})
|
|
getRemoteUrlForRepoMock.mockResolvedValueOnce('git@github.com:fork/orca.git')
|
|
|
|
await getPullRequestPushTarget('/repo-root', 1738, null, {}, 'origin')
|
|
|
|
expect(resolvePRRepositoryCandidatesMock).not.toHaveBeenCalled()
|
|
expect(ghExecFileAsyncMock).toHaveBeenCalledWith(['api', 'repos/fork/orca/pulls/1738'], {
|
|
cwd: '/repo-root',
|
|
host: 'github.com'
|
|
})
|
|
expect(ghExecFileAsyncMock).not.toHaveBeenCalledWith(
|
|
['api', 'repos/upstream/orca/pulls/1738'],
|
|
expect.anything()
|
|
)
|
|
})
|
|
|
|
it('surfaces maintainer_can_modify=false alongside a fork PR push target', async () => {
|
|
getOwnerRepoMock.mockResolvedValueOnce({ owner: 'stablyai', repo: 'orca' })
|
|
getOwnerRepoForRemoteMock.mockResolvedValueOnce({ owner: 'stablyai', repo: 'orca' })
|
|
ghExecFileAsyncMock.mockResolvedValueOnce({
|
|
stdout: JSON.stringify({
|
|
maintainer_can_modify: false,
|
|
head: {
|
|
ref: 'prateek/fix-sidebar-agents-toggle',
|
|
repo: {
|
|
full_name: 'prateek/orca',
|
|
name: 'orca',
|
|
clone_url: 'https://github.com/prateek/orca.git',
|
|
ssh_url: 'git@github.com:prateek/orca.git',
|
|
owner: { login: 'prateek' }
|
|
}
|
|
}
|
|
})
|
|
})
|
|
getRemoteUrlForRepoMock.mockResolvedValueOnce('git@github.com:stablyai/orca.git')
|
|
|
|
await expect(getPullRequestPushTarget('/repo-root', 1738)).resolves.toEqual({
|
|
pushTarget: {
|
|
remoteName: 'pr-prateek-orca',
|
|
branchName: 'prateek/fix-sidebar-agents-toggle',
|
|
remoteUrl: 'git@github.com:prateek/orca.git'
|
|
},
|
|
maintainerCanModify: false
|
|
})
|
|
})
|
|
|
|
it('omits maintainerCanModify when the API does not report the flag', async () => {
|
|
getOwnerRepoMock.mockResolvedValueOnce({ owner: 'stablyai', repo: 'orca' })
|
|
getOwnerRepoForRemoteMock.mockResolvedValueOnce({ owner: 'stablyai', repo: 'orca' })
|
|
ghExecFileAsyncMock.mockResolvedValueOnce({
|
|
stdout: JSON.stringify({
|
|
head: {
|
|
ref: 'fix-sidebar',
|
|
repo: {
|
|
full_name: 'stablyai/orca',
|
|
name: 'orca',
|
|
clone_url: 'https://github.com/stablyai/orca.git',
|
|
ssh_url: 'git@github.com:stablyai/orca.git',
|
|
owner: { login: 'stablyai' }
|
|
}
|
|
}
|
|
})
|
|
})
|
|
|
|
await expect(getPullRequestPushTarget('/repo-root', 1738)).resolves.toEqual({
|
|
pushTarget: {
|
|
remoteName: 'origin',
|
|
branchName: 'fix-sidebar'
|
|
}
|
|
})
|
|
})
|
|
|
|
it('uses origin for same-repository PR push targets', async () => {
|
|
getOwnerRepoMock.mockResolvedValueOnce({ owner: 'stablyai', repo: 'orca' })
|
|
getOwnerRepoForRemoteMock.mockResolvedValueOnce({ owner: 'stablyai', repo: 'orca' })
|
|
ghExecFileAsyncMock.mockResolvedValueOnce({
|
|
stdout: JSON.stringify({
|
|
head: {
|
|
ref: 'fix-sidebar',
|
|
repo: {
|
|
full_name: 'stablyai/orca',
|
|
name: 'orca',
|
|
clone_url: 'https://github.com/stablyai/orca.git',
|
|
ssh_url: 'git@github.com:stablyai/orca.git',
|
|
owner: { login: 'stablyai' }
|
|
}
|
|
}
|
|
})
|
|
})
|
|
|
|
await expect(getPullRequestPushTarget('/repo-root', 1738)).resolves.toEqual({
|
|
pushTarget: {
|
|
remoteName: 'origin',
|
|
branchName: 'fix-sidebar'
|
|
}
|
|
})
|
|
expect(gitExecFileAsyncMock).not.toHaveBeenCalled()
|
|
})
|
|
|
|
it('keeps getRepoSlug origin-based on a fork checkout (#7331)', async () => {
|
|
// The slug is the checkout's own identity (renderer display, icon
|
|
// autodetect); it must not flip to the upstream parent.
|
|
getOwnerRepoForRemoteMock.mockImplementation(async (_repoPath: string, remoteName: string) =>
|
|
remoteName === 'origin'
|
|
? { owner: 'fsdwen', repo: 'orca' }
|
|
: { owner: 'stablyai', repo: 'orca' }
|
|
)
|
|
// Why: getRepoSlug imports getOriginGitHubApiRepository; the suite bridge
|
|
// prefers getOwnerRepoForRemote for origin, so set both seams.
|
|
getOwnerRepoMock.mockResolvedValue({ owner: 'fsdwen', repo: 'orca' })
|
|
|
|
await expect(getRepoSlug('/repo-root')).resolves.toEqual({
|
|
owner: 'fsdwen',
|
|
repo: 'orca',
|
|
host: 'github.com'
|
|
})
|
|
})
|
|
|
|
it('resolves a distinct upstream remote as the repo upstream', async () => {
|
|
// getRepoUpstream probes origin then upstream via getOwnerRepoForRemote (#7331).
|
|
getOwnerRepoMock.mockResolvedValue({ owner: 'tmchow', repo: 'orca' })
|
|
getOwnerRepoForRemoteMock.mockImplementation(async (_repoPath: string, remoteName: string) =>
|
|
remoteName === 'origin'
|
|
? { owner: 'tmchow', repo: 'orca' }
|
|
: { owner: 'stablyai', repo: 'orca' }
|
|
)
|
|
|
|
// Why: the suite bridge returns getOwnerRepoForRemote fixtures as-is (no host pin).
|
|
await expect(getRepoUpstream('/repo-root')).resolves.toEqual({
|
|
owner: 'stablyai',
|
|
repo: 'orca'
|
|
})
|
|
|
|
expect(ghExecFileAsyncMock).not.toHaveBeenCalled()
|
|
})
|
|
|
|
it('does not treat a same-repository upstream remote as a fork', async () => {
|
|
getOwnerRepoMock.mockResolvedValue({ owner: 'StablyAI', repo: 'Orca' })
|
|
getOwnerRepoForRemoteMock.mockImplementation(async (_repoPath: string, remoteName: string) =>
|
|
remoteName === 'origin'
|
|
? { owner: 'StablyAI', repo: 'Orca' }
|
|
: { owner: 'stablyai', repo: 'orca' }
|
|
)
|
|
ghExecFileAsyncMock.mockResolvedValueOnce({
|
|
stdout: JSON.stringify({ isFork: false, parent: null })
|
|
})
|
|
|
|
await expect(getRepoUpstream('/repo-root')).resolves.toBeNull()
|
|
|
|
expect(ghExecFileAsyncMock).toHaveBeenCalledWith(
|
|
// Why: positional slugs are explicit about github.com too, so GH_HOST
|
|
// cannot redirect them.
|
|
['repo', 'view', 'github.com/StablyAI/Orca', '--json', 'isFork,parent'],
|
|
{ cwd: '/repo-root', host: 'github.com', timeout: 10_000 }
|
|
)
|
|
})
|
|
|
|
it('does not mark an upstream-only GitHub remote as a fork', async () => {
|
|
// Missing origin short-circuits before the upstream probe.
|
|
getOwnerRepoForRemoteMock.mockResolvedValueOnce(null)
|
|
|
|
await expect(getRepoUpstream('/repo-root')).resolves.toBeNull()
|
|
|
|
expect(getOwnerRepoForRemoteMock).toHaveBeenCalledTimes(1)
|
|
expect(getOwnerRepoForRemoteMock).toHaveBeenCalledWith('/repo-root', 'origin', undefined, {})
|
|
expect(ghExecFileAsyncMock).not.toHaveBeenCalled()
|
|
})
|
|
|
|
it('falls back to the GitHub parent when no upstream remote is configured', async () => {
|
|
getOwnerRepoForRemoteMock
|
|
.mockResolvedValueOnce({ owner: 'tmchow', repo: 'orca' })
|
|
.mockResolvedValueOnce(null)
|
|
ghExecFileAsyncMock.mockResolvedValueOnce({
|
|
stdout: JSON.stringify({
|
|
isFork: true,
|
|
parent: { name: 'orca', owner: { login: 'stablyai' } }
|
|
})
|
|
})
|
|
|
|
await expect(getRepoUpstream('/repo-root')).resolves.toEqual({
|
|
owner: 'stablyai',
|
|
repo: 'orca',
|
|
// Why: fork parents live on the same server as the fork's origin.
|
|
host: 'github.com'
|
|
})
|
|
})
|
|
|
|
it('routes GHES push-target probes through the Enterprise host', async () => {
|
|
const ghes = { owner: 'team', repo: 'orca', host: 'github.acme-corp.com' }
|
|
resolvePRRepositoryCandidatesMock.mockResolvedValueOnce({
|
|
candidates: [ghes],
|
|
headRepo: ghes
|
|
})
|
|
getOwnerRepoForRemoteMock.mockResolvedValueOnce(ghes)
|
|
ghExecFileAsyncMock.mockResolvedValueOnce({
|
|
stdout: JSON.stringify({
|
|
head: {
|
|
ref: 'feature',
|
|
repo: {
|
|
full_name: 'team/orca',
|
|
name: 'orca',
|
|
clone_url: 'https://github.acme-corp.com/team/orca.git',
|
|
ssh_url: 'git@github.acme-corp.com:team/orca.git',
|
|
owner: { login: 'team' }
|
|
}
|
|
}
|
|
})
|
|
})
|
|
|
|
await expect(getPullRequestPushTarget('/repo-root', 7)).resolves.toEqual({
|
|
pushTarget: { remoteName: 'origin', branchName: 'feature' }
|
|
})
|
|
// Why: the candidate probe must pin options.host so the runner targets the
|
|
// Enterprise server instead of gh's default host.
|
|
expect(ghExecFileAsyncMock).toHaveBeenCalledWith(
|
|
['api', 'repos/team/orca/pulls/7'],
|
|
expect.objectContaining({ host: 'github.acme-corp.com' })
|
|
)
|
|
})
|
|
|
|
it('does not confuse same-slug PR repositories across GitHub hosts', async () => {
|
|
const enterprise = { owner: 'team', repo: 'orca', host: 'github.acme-corp.com' }
|
|
const dotCom = { owner: 'team', repo: 'orca', host: 'github.com' }
|
|
resolvePRRepositoryCandidatesMock.mockResolvedValueOnce({
|
|
candidates: [enterprise, dotCom],
|
|
headRepo: dotCom
|
|
})
|
|
getOwnerRepoForRemoteMock.mockResolvedValueOnce(dotCom)
|
|
getRemoteUrlForRepoMock.mockResolvedValueOnce('git@github.com:team/orca.git')
|
|
ghExecFileAsyncMock.mockResolvedValueOnce({
|
|
stdout: JSON.stringify({
|
|
head: {
|
|
ref: 'feature',
|
|
repo: {
|
|
full_name: 'team/orca',
|
|
name: 'orca',
|
|
clone_url: 'https://github.acme-corp.com/team/orca.git',
|
|
ssh_url: 'git@github.acme-corp.com:team/orca.git',
|
|
owner: { login: 'team' }
|
|
}
|
|
}
|
|
})
|
|
})
|
|
|
|
await expect(getPullRequestPushTarget('/repo-root', 7)).resolves.toEqual({
|
|
pushTarget: {
|
|
remoteName: 'pr-team-orca',
|
|
branchName: 'feature',
|
|
remoteUrl: 'git@github.acme-corp.com:team/orca.git'
|
|
}
|
|
})
|
|
})
|
|
|
|
it('probes additional PR repo candidates when the first lookup is not found', async () => {
|
|
resolvePRRepositoryCandidatesMock.mockResolvedValueOnce({
|
|
candidates: [
|
|
{ owner: 'fork', repo: 'orca' },
|
|
{ owner: 'stablyai', repo: 'orca' }
|
|
],
|
|
headRepo: { owner: 'fork', repo: 'orca' }
|
|
})
|
|
getOwnerRepoForRemoteMock.mockResolvedValueOnce({ owner: 'fork', repo: 'orca' })
|
|
ghExecFileAsyncMock
|
|
.mockRejectedValueOnce(new Error('HTTP 404: Not Found'))
|
|
.mockResolvedValueOnce({
|
|
stdout: JSON.stringify({
|
|
head: {
|
|
ref: 'feature/test',
|
|
repo: {
|
|
full_name: 'fork/orca',
|
|
name: 'orca',
|
|
clone_url: 'https://github.com/fork/orca.git',
|
|
ssh_url: 'git@github.com:fork/orca.git',
|
|
owner: { login: 'fork' }
|
|
}
|
|
}
|
|
})
|
|
})
|
|
|
|
await expect(getPullRequestPushTarget('/repo-root', 1849)).resolves.toEqual({
|
|
pushTarget: {
|
|
remoteName: 'origin',
|
|
branchName: 'feature/test'
|
|
}
|
|
})
|
|
expect(ghExecFileAsyncMock).toHaveBeenNthCalledWith(1, ['api', 'repos/fork/orca/pulls/1849'], {
|
|
cwd: '/repo-root'
|
|
})
|
|
expect(ghExecFileAsyncMock).toHaveBeenNthCalledWith(
|
|
2,
|
|
['api', 'repos/stablyai/orca/pulls/1849'],
|
|
{ cwd: '/repo-root' }
|
|
)
|
|
})
|
|
|
|
it('probes the next PR work-item candidate after a permission denial', async () => {
|
|
const upstream = { owner: 'upstream', repo: 'orca', host: 'github.com' }
|
|
const origin = { owner: 'fork', repo: 'orca', host: 'github.com' }
|
|
resolvePRRepositoryCandidatesMock.mockResolvedValueOnce({
|
|
candidates: [upstream, origin],
|
|
headRepo: origin
|
|
})
|
|
ghExecFileAsyncMock
|
|
.mockRejectedValueOnce(new Error('GraphQL: Resource not accessible by integration'))
|
|
.mockRejectedValueOnce(new Error('GraphQL: Resource not accessible by integration'))
|
|
.mockResolvedValueOnce({
|
|
stdout: JSON.stringify({
|
|
number: 42,
|
|
title: 'Origin PR',
|
|
state: 'OPEN',
|
|
url: 'https://github.com/fork/orca/pull/42',
|
|
labels: [],
|
|
updatedAt: '2026-07-16T00:00:00Z',
|
|
author: { login: 'octo' },
|
|
isDraft: false
|
|
})
|
|
})
|
|
.mockRejectedValueOnce(new Error('metadata unavailable'))
|
|
|
|
await expect(getWorkItem('/repo-root', 42, 'pr')).resolves.toMatchObject({
|
|
number: 42,
|
|
title: 'Origin PR',
|
|
prRepo: origin
|
|
})
|
|
|
|
expect(ghExecFileAsyncMock.mock.calls[0][0]).toEqual(
|
|
expect.arrayContaining(['pr', 'view', '--repo', 'upstream/orca'])
|
|
)
|
|
expect(ghExecFileAsyncMock.mock.calls[1][0]).toEqual(['api', 'repos/upstream/orca/pulls/42'])
|
|
expect(ghExecFileAsyncMock.mock.calls[2][0]).toEqual(
|
|
expect.arrayContaining(['pr', 'view', '--repo', 'fork/orca'])
|
|
)
|
|
})
|
|
|
|
it('normalizes reviewer avatars from REST pull request payloads', async () => {
|
|
getOwnerRepoMock.mockResolvedValueOnce({ owner: 'acme', repo: 'widgets' })
|
|
ghExecFileAsyncMock.mockResolvedValueOnce({
|
|
stdout: JSON.stringify({
|
|
number: 42,
|
|
title: 'Review me',
|
|
state: 'open',
|
|
html_url: 'https://github.com/acme/widgets/pull/42',
|
|
labels: [],
|
|
updated_at: '2026-03-28T00:00:00Z',
|
|
user: { login: 'author' },
|
|
draft: false,
|
|
requested_reviewers: [
|
|
{
|
|
login: 'AmethystLiang',
|
|
avatar_url: 'https://avatars.githubusercontent.com/u/1?v=4'
|
|
}
|
|
]
|
|
})
|
|
})
|
|
|
|
await expect(getWorkItem('/repo-root', 42, 'pr')).resolves.toMatchObject({
|
|
reviewRequests: [
|
|
{
|
|
login: 'AmethystLiang',
|
|
avatarUrl: 'https://avatars.githubusercontent.com/u/1?v=4'
|
|
}
|
|
]
|
|
})
|
|
})
|
|
})
|