Skip to content

Black Friday

Annual Pro is $90 for the first year, normally $120. Or start monthly at $6 for two months, then $12.

Ends Dec 4, 11:59 PM PT.

Create an account
← Public packages

@kentcdodds/ship-pr

Progressive ship-pr loop for agents: PR status, Bugbot, review sort, human review feedback, 7-day decisions, merge, deploy, wrap-up.

FollowFork

Files

merge-outcome.test.ts

25 lines · 1.2 KB · TypeScript
import assert from 'node:assert/strict'
import test from 'node:test'
import { describeMergeOutcome } from './merge-outcome.ts'

test('merged results have no reasons', () => {
	assert.deepEqual(describeMergeOutcome({ merged: true, status: 'merged' }), { status: 'merged', reasons: [] })
})

test('not merged surfaces the delegated status, message, and hint', () => {
	assert.deepEqual(
		describeMergeOutcome({ merged: false, status: 'queued', message: 'PR #1 was added to the merge queue.', hint: 'Call again later.' }),
		{ status: 'queued', reasons: ['merge: queued (PR #1 was added to the merge queue. Call again later.)'] },
	)
	assert.deepEqual(describeMergeOutcome({ merged: false, status: 'merge_dispatched', message: 'Still merging.', workflowId: 'wf_1' }).reasons, [
		'merge: merge_dispatched (Still merging. workflowId wf_1)',
	])
})

test('a bare merged:false still gets a reason', () => {
	assert.deepEqual(describeMergeOutcome({ merged: false, mergeableState: 'clean' }), {
		status: 'unknown',
		reasons: ['merge: unknown (GitHub pr/merge returned merged:false with no message (status unknown, mergeable_state=clean). Re-run ./merge or check the PR on GitHub.)'],
	})
	assert.equal(describeMergeOutcome(undefined).reasons.length, 1)
})