[Init] Initial commit - NetMesh terminal manager
Some checks failed
build-packages / resolve bundled mosh-client (push) Has been cancelled
build-packages / resolve bundled et-client (push) Has been cancelled
build-packages / build-macos (push) Has been cancelled
build-packages / build-windows (push) Has been cancelled
build-packages / build-linux-x64 (push) Has been cancelled
build-packages / build-linux-arm64 (push) Has been cancelled
build-packages / release (push) Has been cancelled
build-packages / update Nix release metadata (push) Has been cancelled
build-packages / bump homebrew tap (push) Has been cancelled
test / lint-and-test (push) Has been cancelled
AI automation / Route event (push) Has been cancelled
AI automation / Hand reopened issue to maintainers (push) Has been cancelled
AI automation / Clean source issue state (push) Has been cancelled
AI automation / Reconcile handoffs (push) Has been cancelled
AI automation / Classify issue (push) Has been cancelled
AI automation / Claude Code smoke (push) Has been cancelled
AI automation / Review issue follow-up (push) Has been cancelled
AI automation / Publish issue follow-up (push) Has been cancelled
AI automation / Implement with Claude Code (push) Has been cancelled
AI automation / Publish implement PR (push) Has been cancelled
AI automation / Continue queued issue comments (push) Has been cancelled
AI automation / Codex review loop (push) Has been cancelled
AI automation / Publish Codex fix (push) Has been cancelled
AI automation / Clear Codex dispatch marker (push) Has been cancelled
AI automation / Own PR re-request Codex (push) Has been cancelled
AI automation / External PR re-request Codex (push) Has been cancelled
AI automation / Poll Codex reaction / retry (push) Has been cancelled
build-et-binaries / build-linux-x64 (push) Has been cancelled
build-et-binaries / build-linux-arm64 (push) Has been cancelled
build-et-binaries / build-macos-universal (push) Has been cancelled
build-et-binaries / build-windows-x64 (push) Has been cancelled
build-et-binaries / release (push) Has been cancelled
Some checks failed
build-packages / resolve bundled mosh-client (push) Has been cancelled
build-packages / resolve bundled et-client (push) Has been cancelled
build-packages / build-macos (push) Has been cancelled
build-packages / build-windows (push) Has been cancelled
build-packages / build-linux-x64 (push) Has been cancelled
build-packages / build-linux-arm64 (push) Has been cancelled
build-packages / release (push) Has been cancelled
build-packages / update Nix release metadata (push) Has been cancelled
build-packages / bump homebrew tap (push) Has been cancelled
test / lint-and-test (push) Has been cancelled
AI automation / Route event (push) Has been cancelled
AI automation / Hand reopened issue to maintainers (push) Has been cancelled
AI automation / Clean source issue state (push) Has been cancelled
AI automation / Reconcile handoffs (push) Has been cancelled
AI automation / Classify issue (push) Has been cancelled
AI automation / Claude Code smoke (push) Has been cancelled
AI automation / Review issue follow-up (push) Has been cancelled
AI automation / Publish issue follow-up (push) Has been cancelled
AI automation / Implement with Claude Code (push) Has been cancelled
AI automation / Publish implement PR (push) Has been cancelled
AI automation / Continue queued issue comments (push) Has been cancelled
AI automation / Codex review loop (push) Has been cancelled
AI automation / Publish Codex fix (push) Has been cancelled
AI automation / Clear Codex dispatch marker (push) Has been cancelled
AI automation / Own PR re-request Codex (push) Has been cancelled
AI automation / External PR re-request Codex (push) Has been cancelled
AI automation / Poll Codex reaction / retry (push) Has been cancelled
build-et-binaries / build-linux-x64 (push) Has been cancelled
build-et-binaries / build-linux-arm64 (push) Has been cancelled
build-et-binaries / build-macos-universal (push) Has been cancelled
build-et-binaries / build-windows-x64 (push) Has been cancelled
build-et-binaries / release (push) Has been cancelled
This commit is contained in:
109
components/sftp/SftpConflictDialog.test.ts
Normal file
109
components/sftp/SftpConflictDialog.test.ts
Normal file
@@ -0,0 +1,109 @@
|
||||
import test from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
|
||||
import {
|
||||
canReplaceConflict,
|
||||
getSftpConflictDialogPresentation,
|
||||
} from "./SftpConflictDialog.tsx";
|
||||
|
||||
test("does not offer replace when a file upload conflicts with an existing directory", () => {
|
||||
assert.equal(canReplaceConflict({
|
||||
isDirectory: false,
|
||||
existingType: "directory",
|
||||
}), false);
|
||||
});
|
||||
|
||||
test("does not offer replace when a directory upload conflicts with an existing file", () => {
|
||||
assert.equal(canReplaceConflict({
|
||||
isDirectory: true,
|
||||
existingType: "file",
|
||||
}), false);
|
||||
});
|
||||
|
||||
test("offers replace when a file upload conflicts with an existing file", () => {
|
||||
assert.equal(canReplaceConflict({
|
||||
isDirectory: false,
|
||||
existingType: "file",
|
||||
}), true);
|
||||
});
|
||||
|
||||
test("offers replace when a directory upload conflicts with an existing symlink", () => {
|
||||
assert.equal(canReplaceConflict({
|
||||
isDirectory: true,
|
||||
existingType: "symlink",
|
||||
}), true);
|
||||
});
|
||||
|
||||
test("offers replace when a file upload conflicts with an existing symlink", () => {
|
||||
assert.equal(canReplaceConflict({
|
||||
isDirectory: false,
|
||||
existingType: "symlink",
|
||||
}), true);
|
||||
});
|
||||
|
||||
test("does not offer replace when a folder conflict has an unknown destination type", () => {
|
||||
assert.equal(canReplaceConflict({
|
||||
isDirectory: true,
|
||||
existingType: undefined,
|
||||
}), false);
|
||||
|
||||
const presentation = getSftpConflictDialogPresentation({
|
||||
isDirectory: true,
|
||||
existingType: undefined,
|
||||
});
|
||||
assert.equal(presentation.descriptionKey, "sftp.conflict.folderUnknownDesc");
|
||||
assert.equal(presentation.showDirectoryReplaceWarning, false);
|
||||
assert.equal(presentation.replaceVariant, "default");
|
||||
});
|
||||
|
||||
test("makes merge the safe primary action for a same-named folder conflict", () => {
|
||||
assert.deepEqual(getSftpConflictDialogPresentation({
|
||||
isDirectory: true,
|
||||
existingType: "directory",
|
||||
}), {
|
||||
titleKey: "sftp.conflict.folderTitle",
|
||||
descriptionKey: "sftp.conflict.folderDesc",
|
||||
showFileMetadata: false,
|
||||
showDirectoryReplaceWarning: true,
|
||||
mergeVariant: "default",
|
||||
replaceVariant: "outline",
|
||||
});
|
||||
});
|
||||
|
||||
test("keeps the existing file conflict presentation unchanged", () => {
|
||||
assert.deepEqual(getSftpConflictDialogPresentation({
|
||||
isDirectory: false,
|
||||
existingType: "file",
|
||||
}), {
|
||||
titleKey: "sftp.conflict.title",
|
||||
descriptionKey: "sftp.conflict.desc",
|
||||
showFileMetadata: true,
|
||||
showDirectoryReplaceWarning: false,
|
||||
mergeVariant: "outline",
|
||||
replaceVariant: "default",
|
||||
});
|
||||
});
|
||||
|
||||
test("does not show the directory deletion warning when replacing a symlink", () => {
|
||||
const presentation = getSftpConflictDialogPresentation({
|
||||
isDirectory: true,
|
||||
existingType: "symlink",
|
||||
});
|
||||
|
||||
assert.equal(presentation.titleKey, "sftp.conflict.folderTitle");
|
||||
assert.equal(presentation.descriptionKey, "sftp.conflict.folderSymlinkDesc");
|
||||
assert.equal(presentation.showDirectoryReplaceWarning, false);
|
||||
assert.equal(presentation.replaceVariant, "default");
|
||||
});
|
||||
|
||||
test("explains why a folder cannot merge with an existing file", () => {
|
||||
const presentation = getSftpConflictDialogPresentation({
|
||||
isDirectory: true,
|
||||
existingType: "file",
|
||||
});
|
||||
|
||||
assert.equal(presentation.titleKey, "sftp.conflict.folderTitle");
|
||||
assert.equal(presentation.descriptionKey, "sftp.conflict.folderFileDesc");
|
||||
assert.equal(presentation.showDirectoryReplaceWarning, false);
|
||||
assert.equal(presentation.mergeVariant, "outline");
|
||||
});
|
||||
Reference in New Issue
Block a user