45 lines
1.4 KiB
TypeScript
45 lines
1.4 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { humanizeBulkReason } from './bulkReason'
|
|
|
|
describe('humanizeBulkReason', () => {
|
|
it('maps self_approve_forbidden to russian title', () => {
|
|
expect(humanizeBulkReason('self_approve_forbidden')).toBe(
|
|
'Нельзя одобрить свой draft (maker-checker)',
|
|
)
|
|
})
|
|
|
|
it('maps draft_not_pending to russian title', () => {
|
|
expect(humanizeBulkReason('draft_not_pending')).toBe(
|
|
'Draft уже не pending — обнови очередь',
|
|
)
|
|
})
|
|
|
|
it('maps forbidden_role to russian title', () => {
|
|
expect(humanizeBulkReason('forbidden_role')).toBe(
|
|
'Недостаточно прав (нужна reviewer role)',
|
|
)
|
|
})
|
|
|
|
it('maps reject_reason_required to russian title', () => {
|
|
expect(humanizeBulkReason('reject_reason_required')).toBe(
|
|
'Reject требует comment (compliance)',
|
|
)
|
|
})
|
|
|
|
it('maps self_reject_forbidden to russian title', () => {
|
|
expect(humanizeBulkReason('self_reject_forbidden')).toBe(
|
|
'Нельзя отклонить свой draft',
|
|
)
|
|
})
|
|
|
|
it('returns unknown reason as-is (backend message fallback)', () => {
|
|
expect(humanizeBulkReason('Some raw backend message')).toBe(
|
|
'Some raw backend message',
|
|
)
|
|
})
|
|
|
|
it('returns empty string for empty input', () => {
|
|
expect(humanizeBulkReason('')).toBe('')
|
|
})
|
|
})
|