mirror of
https://github.com/stablyai/orca.git
synced 2026-10-30 16:47:34 +00:00
41 lines
1.6 KiB
TypeScript
41 lines
1.6 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { mobileI18n } from '../i18n/mobile-i18n'
|
|
import {
|
|
isMobileConflictAborting,
|
|
mobileConflictAbortLabel
|
|
} from './mobile-source-control-conflict-abort'
|
|
|
|
describe('isMobileConflictAborting', () => {
|
|
it('is true only for the matching abort action', () => {
|
|
expect(isMobileConflictAborting('abort-merge', 'merge')).toBe(true)
|
|
expect(isMobileConflictAborting('abort-rebase', 'rebase')).toBe(true)
|
|
})
|
|
|
|
it('is false for other busy actions (stage/commit must not look like abort)', () => {
|
|
expect(isMobileConflictAborting('stage-all', 'merge')).toBe(false)
|
|
expect(isMobileConflictAborting('commit', 'rebase')).toBe(false)
|
|
expect(isMobileConflictAborting(null, 'merge')).toBe(false)
|
|
expect(isMobileConflictAborting('abort-merge', 'rebase')).toBe(false)
|
|
expect(isMobileConflictAborting('abort-merge', 'unknown')).toBe(false)
|
|
})
|
|
})
|
|
|
|
describe('mobileConflictAbortLabel', () => {
|
|
it('shows Aborting only while abort is in flight', () => {
|
|
expect(mobileConflictAbortLabel('merge', true)).toBe('Aborting…')
|
|
expect(mobileConflictAbortLabel('merge', false)).toBe('Abort merge')
|
|
expect(mobileConflictAbortLabel('rebase', false)).toBe('Abort rebase')
|
|
})
|
|
|
|
it('uses complete translated operation labels', async () => {
|
|
const initialLocale = mobileI18n.language
|
|
await mobileI18n.changeLanguage('es')
|
|
try {
|
|
expect(mobileConflictAbortLabel('merge', false)).toBe('Abortar fusión')
|
|
expect(mobileConflictAbortLabel('rebase', false)).toBe('Abortar rebase')
|
|
} finally {
|
|
await mobileI18n.changeLanguage(initialLocale)
|
|
}
|
|
})
|
|
})
|