mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-21 23:50:45 +00:00
Track UploadController instances per transfer task so queue cancel of one external upload does not abort another concurrent paste/drop upload. Scope pending conflict prompts to the owning controller as well.
23 lines
993 B
TypeScript
23 lines
993 B
TypeScript
import test from "node:test";
|
|
import assert from "node:assert/strict";
|
|
import { readFileSync } from "node:fs";
|
|
|
|
test("external upload cancellation is keyed by transfer task id", () => {
|
|
const ops = readFileSync(new URL("./useSftpExternalOperations.ts", import.meta.url), "utf8");
|
|
assert.match(ops, /uploadControllersByTaskRef/);
|
|
assert.match(ops, /const cancelExternalUpload = useCallback\(async \(taskId\?: string\)/);
|
|
assert.match(ops, /bindUploadControllerCallbacks/);
|
|
|
|
const queue = readFileSync(
|
|
new URL("../../../components/sftp/SftpTransferQueue.tsx", import.meta.url),
|
|
"utf8",
|
|
);
|
|
assert.match(queue, /cancelExternalUpload\(task\.id\)/);
|
|
});
|
|
|
|
test("upload conflict cancel is scoped to owning controller", () => {
|
|
const ops = readFileSync(new URL("./useSftpExternalOperations.ts", import.meta.url), "utf8");
|
|
assert.match(ops, /uploadConflictOwnersRef/);
|
|
assert.match(ops, /cancelPendingUploadConflicts = useCallback\(\(controller\?: UploadController\)/);
|
|
});
|