mirror of
https://github.com/stablyai/orca.git
synced 2026-10-02 16:02:15 +00:00
@@ -300,6 +300,34 @@ describe('github RPC methods', () => {
|
||||
expect(response).toMatchObject({ ok: true, result: true })
|
||||
})
|
||||
|
||||
it('updates PR metadata on the runtime server', async () => {
|
||||
const runtime = {
|
||||
getRuntimeId: () => 'test-runtime',
|
||||
updateRepoPRDetails: vi.fn().mockResolvedValue({ ok: true })
|
||||
} as unknown as OrcaRuntimeService
|
||||
const dispatcher = new RpcDispatcher({ runtime, methods: GITHUB_METHODS })
|
||||
|
||||
const response = await dispatcher.dispatch(
|
||||
makeRequest('github.updatePR', {
|
||||
repo: 'repo-1',
|
||||
prNumber: 7,
|
||||
updates: { title: 'New title', body: 'Updated body' },
|
||||
prRepo: { owner: 'acme', repo: 'widgets' }
|
||||
})
|
||||
)
|
||||
|
||||
expect(runtime.updateRepoPRDetails).toHaveBeenCalledWith(
|
||||
'repo-1',
|
||||
7,
|
||||
{ title: 'New title', body: 'Updated body' },
|
||||
{
|
||||
owner: 'acme',
|
||||
repo: 'widgets'
|
||||
}
|
||||
)
|
||||
expect(response).toMatchObject({ ok: true, result: { ok: true } })
|
||||
})
|
||||
|
||||
it('merges PRs on the runtime server', async () => {
|
||||
const runtime = {
|
||||
getRuntimeId: () => 'test-runtime',
|
||||
@@ -323,6 +351,35 @@ describe('github RPC methods', () => {
|
||||
expect(response).toMatchObject({ ok: true, result: { ok: true } })
|
||||
})
|
||||
|
||||
it('routes PR reviewer mutations on the runtime server', async () => {
|
||||
const runtime = {
|
||||
getRuntimeId: () => 'test-runtime',
|
||||
requestRepoPRReviewers: vi.fn().mockResolvedValue({ ok: true }),
|
||||
removeRepoPRReviewers: vi.fn().mockResolvedValue({ ok: true })
|
||||
} as unknown as OrcaRuntimeService
|
||||
const dispatcher = new RpcDispatcher({ runtime, methods: GITHUB_METHODS })
|
||||
|
||||
const requestResponse = await dispatcher.dispatch(
|
||||
makeRequest('github.requestPRReviewers', {
|
||||
repo: 'repo-1',
|
||||
prNumber: 7,
|
||||
reviewers: ['octo']
|
||||
})
|
||||
)
|
||||
const removeResponse = await dispatcher.dispatch(
|
||||
makeRequest('github.removePRReviewers', {
|
||||
repo: 'repo-1',
|
||||
prNumber: 7,
|
||||
reviewers: ['octo']
|
||||
})
|
||||
)
|
||||
|
||||
expect(runtime.requestRepoPRReviewers).toHaveBeenCalledWith('repo-1', 7, ['octo'])
|
||||
expect(runtime.removeRepoPRReviewers).toHaveBeenCalledWith('repo-1', 7, ['octo'])
|
||||
expect(requestResponse).toMatchObject({ ok: true, result: { ok: true } })
|
||||
expect(removeResponse).toMatchObject({ ok: true, result: { ok: true } })
|
||||
})
|
||||
|
||||
it('updates PR state on the runtime server', async () => {
|
||||
const runtime = {
|
||||
getRuntimeId: () => 'test-runtime',
|
||||
|
||||
Reference in New Issue
Block a user