Files
opsxshell/test/components/sftp/transferConflicts.test.ts
T
Logan.LiandCursor 08696896f9 feat: harden local shell, SFTP, and desktop session reliability
Finder-launched terminals now inherit a login PATH so tools like ollama resolve, destructive SFTP/editor actions require confirmation, and terminal search plus window dragging work again. SSH forwards and RDP sessions keep listeners and survive reconnect without FastPath crashes.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-16 16:08:11 +08:00

28 lines
1.1 KiB
TypeScript

import { describe, expect, it } from 'vitest'
import {
conflictNamesFromListing,
formatOverwriteMessage,
transferDestinationPath,
} from '../../../src/components/sftp/transferConflicts'
describe('transferConflicts', () => {
it('builds remote and local destination paths', () => {
expect(transferDestinationPath('upload', '/', 'a.txt')).toBe('/a.txt')
expect(transferDestinationPath('upload', '/root/', 'a.txt')).toBe('/root/a.txt')
expect(transferDestinationPath('download', '/Users/test', 'a.txt')).toBe('/Users/test/a.txt')
})
it('finds conflicts from a listing', () => {
expect(
conflictNamesFromListing(['a.txt', 'b.txt', 'c.txt'], [{ name: 'b.txt' }, { name: 'c.txt' }])
).toEqual(['b.txt', 'c.txt'])
})
it('formats overwrite copy for one and many', () => {
const t = (key: string, opts?: Record<string, unknown>) =>
`${key}:${opts ? JSON.stringify(opts) : ''}`
expect(formatOverwriteMessage(['only.log'], 'upload', t)).toContain('overwriteOneRemote')
expect(formatOverwriteMessage(['a', 'b', 'c'], 'download', t)).toContain('overwriteManyLocal')
})
})