mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-21 23:50:45 +00:00
fix: address Codex review on PR #2569
This commit is contained in:
1 parent
44b87a815b
commit
16eae0d4e1
2 files changed
+67
-13
No files matched your search
@@ -2881,3 +2881,49 @@ test("panel completed sticks while directory walk is still in flight (issue #256
|
||||
assert.equal(row?.status, "completed");
|
||||
assert.equal(store.getSnapshot().activeCount, 0);
|
||||
});
|
||||
|
||||
test("stale terminal panel snapshot cannot overwrite newer soft-control epoch", async (t) => {
|
||||
const {
|
||||
registerTransferWalk,
|
||||
unregisterTransferWalk,
|
||||
resetTransferWalkRegistryForTests,
|
||||
} = await import("./sftp/transferWalkRegistry");
|
||||
const { resetTransferControlEpochsForTests } = await import("./sftp/transferControlEpoch");
|
||||
resetTransferWalkRegistryForTests();
|
||||
resetTransferControlEpochsForTests();
|
||||
registerTransferWalk("dir-live");
|
||||
t.after(() => {
|
||||
unregisterTransferWalk("dir-live");
|
||||
resetTransferWalkRegistryForTests();
|
||||
resetTransferControlEpochsForTests();
|
||||
});
|
||||
|
||||
const store = createSftpTransferCenterStore();
|
||||
store.publishOwner("panel-a", [{
|
||||
...makeTask("dir-live", "transferring"),
|
||||
fileName: "folder",
|
||||
isDirectory: true,
|
||||
progressMode: "files",
|
||||
totalBytes: 10,
|
||||
transferredBytes: 4,
|
||||
lifecycleEpoch: 2,
|
||||
}]);
|
||||
|
||||
// Delayed panel completion from before soft pause/resume must not win.
|
||||
store.publishOwner("panel-a", [{
|
||||
...makeTask("dir-live", "completed"),
|
||||
fileName: "folder",
|
||||
isDirectory: true,
|
||||
progressMode: "files",
|
||||
totalBytes: 10,
|
||||
transferredBytes: 4,
|
||||
endTime: Date.now(),
|
||||
speed: 0,
|
||||
lifecycleEpoch: 1,
|
||||
}]);
|
||||
|
||||
const row = store.getSnapshot().tasks.find((task) => task.id === "dir-live");
|
||||
assert.equal(row?.status, "transferring");
|
||||
assert.equal(row?.lifecycleEpoch, 2);
|
||||
assert.equal(store.getSnapshot().activeCount, 1);
|
||||
});
|
||||
Reference in new issue
Block a user