Files
PANEL_BASES_ANEXO24/src/lib/server/sftp-transfer.test.ts
AlexeerCT 7f9d502cb1
Some checks failed
Aduanasoft/PANEL_BASES_ANEXO24/pipeline/head There was a failure building this commit
feat(env): update environment configuration and add SQL Server password handling (#15)
- Added new environment variables for deduplication and SQL Server password encryption.
- Updated docker-compose files to include SECRET_KEY and ENCRYPTION_KEY for compatibility with a24c.
- Enhanced the navigation structure to reflect changes in admin-only views and report access.
- Introduced new functions for handling SQL Server connections and database management, including parsing server addresses and listing user databases.

This update improves security and functionality related to database management and user access control.

Reviewed-on: #15
Co-authored-by: AlexeerCT <acazares@aduanasoft.com.mx>
Co-committed-by: AlexeerCT <acazares@aduanasoft.com.mx>
2026-07-06 17:00:49 +00:00

32 lines
1.2 KiB
TypeScript

/**
* Pruebas de las funciones puras de armado de rutas para la transferencia SFTP. La I/O real
* (SFTP/zip) no se prueba aquí; se cubre la construcción de rutas que es donde vive el riesgo
* de separadores Windows/POSIX.
*/
import { describe, it, expect } from 'vitest';
import { joinRemotePath, toSftpPath } from './sftp-transfer';
describe('joinRemotePath', () => {
it('usa backslash cuando la carpeta es estilo Windows', () => {
expect(joinRemotePath('D:\\SQLDATA', 'NODO001.bak')).toBe('D:\\SQLDATA\\NODO001.bak');
});
it('respeta separadores finales duplicados', () => {
expect(joinRemotePath('D:\\SQLDATA\\\\', 'a.zip')).toBe('D:\\SQLDATA\\a.zip');
});
it('usa slash cuando la carpeta es POSIX', () => {
expect(joinRemotePath('/var/inbox/', 'a.zip')).toBe('/var/inbox/a.zip');
});
});
describe('toSftpPath', () => {
it('convierte backslashes de Windows a slashes para OpenSSH SFTP', () => {
expect(toSftpPath('D:\\SQLDATA\\NODO001.bak')).toBe('D:/SQLDATA/NODO001.bak');
});
it('deja intactas las rutas POSIX', () => {
expect(toSftpPath('/var/inbox/a.zip')).toBe('/var/inbox/a.zip');
});
});