Files
orca/src/shared/github/pull-request-merge-methods.test.ts
T
YEONGUK LEEandNeil a3ba93c87b fix(i18n): localize PR merge/close confirmations and merge method labels (#28568)
PR close/reopen/merge confirmation titles were built from a fragment
template ("{{value0}} PR #{{value1}}?"), so locales could not reorder the
verb, and merge method labels came from English-only shared constants.

Add whole-sentence title keys per action and merge method plus translated
merge method labels in a renderer copy module, and route every PR surface
(item dialog, PR page, Tasks MergeCell, right-sidebar HostedReviewActions)
through it. Drop the English labels from the shared merge-method
presentation and remove the dead fragment keys from all locales.

Co-authored-by: Neil <4138956+nwparker@users.noreply.github.com>
2026-10-26 09:52:05 -07:00

41 lines
1.3 KiB
TypeScript

import { describe, expect, it } from 'vitest'
import {
normalizeGitHubPRMergeMethodSettings,
resolveGitHubPRMergeMethods
} from './pull-request-merge-methods'
describe('GitHub PR merge methods', () => {
it('keeps the historical squash-first fallback when repository metadata is missing', () => {
expect(resolveGitHubPRMergeMethods()).toEqual({
defaultMethod: 'squash',
methods: ['squash', 'merge', 'rebase']
})
})
it('uses GitHub viewer defaults and hides methods disabled by the repository', () => {
const settings = normalizeGitHubPRMergeMethodSettings({
defaultMethod: 'REBASE',
mergeCommitAllowed: false,
rebaseMergeAllowed: true,
squashMergeAllowed: true
})
expect(resolveGitHubPRMergeMethods(settings)).toEqual({
defaultMethod: 'rebase',
methods: ['rebase', 'squash']
})
})
it('falls back to an allowed method when GitHub returns a disabled default', () => {
const settings = normalizeGitHubPRMergeMethodSettings({
defaultMethod: 'SQUASH',
mergeCommitAllowed: true,
rebaseMergeAllowed: false,
squashMergeAllowed: false
})
expect(settings?.defaultMethod).toBe('merge')
expect(resolveGitHubPRMergeMethods(settings).methods).toEqual(['merge'])
})
})