mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-28 14:15:24 +00:00
28 lines
936 B
TypeScript
28 lines
936 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
import {
|
|
hasSameHostTransferConflict,
|
|
joinRemotePath,
|
|
normalizeRemoteDir,
|
|
} from "../../src/frontend/sftp-transfer-utils";
|
|
|
|
describe("sftp transfer utilities", () => {
|
|
it("normalizes and joins remote paths", () => {
|
|
expect(normalizeRemoteDir(" /home/user// ")).toBe("/home/user");
|
|
expect(joinRemotePath("/home/user/", "docs/readme.md")).toBe(
|
|
"/home/user/docs/readme.md",
|
|
);
|
|
expect(joinRemotePath("/", "tmp/file.txt")).toBe("/tmp/file.txt");
|
|
expect(joinRemotePath("home/user", "logs")).toBe("/home/user/logs");
|
|
});
|
|
|
|
it("detects same-host destination conflicts", () => {
|
|
expect(hasSameHostTransferConflict(["/opt/app"], "/opt/app")).toBe(true);
|
|
expect(hasSameHostTransferConflict(["/opt/app"], "/opt/app/logs")).toBe(
|
|
true,
|
|
);
|
|
expect(hasSameHostTransferConflict(["/opt/app"], "/opt/releases")).toBe(
|
|
false,
|
|
);
|
|
});
|
|
});
|