Files
Netcatty/application/state/sftp/useSftpSessionErrors.test.ts
T
bincxz 3d140c2f8e fix(sftp): harden folder pause/resume, delete, and root reconnect
Make folder pause latch-first with barriers and a child pause watchdog so
workers stop claiming files after soft-drain; soft-resume live walks instead
of full rewalks. Surface path conflicts with toasts, keep pause progress
visible, and show a resume spinner. Restore verified shell rm -rf with SFTP
confirmation for fast directory delete, and prefer reconnect over wiping the
pane to the host picker when listing fails on some hosts.
2026-07-26 00:10:22 +08:00

57 lines
1.2 KiB
TypeScript

import assert from "node:assert/strict";
import test from "node:test";
import { canReconnectSftpPane } from "./useSftpSessionErrors.ts";
test("can reconnect when lastHost is a vault host", () => {
assert.equal(
canReconnectSftpPane({
lastHost: { id: "h1", label: "box", hostname: "1.2.3.4" } as never,
connection: null,
}),
true,
);
});
test("can reconnect from connection.hostId even when lastHost is missing", () => {
assert.equal(
canReconnectSftpPane({
lastHost: null,
connection: {
id: "c1",
isLocal: false,
hostId: "h1",
hostLabel: "box",
currentPath: "/",
status: "connected",
} as never,
}),
true,
);
});
test("can reconnect for local even without lastHost", () => {
assert.equal(
canReconnectSftpPane({
lastHost: null,
connection: {
id: "local",
isLocal: true,
currentPath: "/",
status: "connected",
} as never,
}),
true,
);
});
test("cannot reconnect without any host identity", () => {
assert.equal(
canReconnectSftpPane({
lastHost: null,
connection: null,
}),
false,
);
});