mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-17 04:50:52 +00:00
* fix(#2727): automated Cursor CLI fix * fix(sftp): drop external-edit retainers when browse sessions close closeSftp already deletes registered temps on disconnect/reconnect; clear the matching renderer retainers so hasActiveWork cannot stick on a gone file. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(sftp): clear external-edit retainers when watches force-stop When the temp file disappears, fileWatcherBridge force-stops the watch with localPath; drop the matching retainer so hasActiveWork cannot stick. Co-authored-by: Cursor <cursoragent@cursor.com> * fix: address Codex review on PR #2730 --------- Co-authored-by: netcatty-bot <308658023+netcatty-bot@users.noreply.github.com> Co-authored-by: bincxz <16399091+binaricat@users.noreply.github.com> Co-authored-by: Cursor <cursoragent@cursor.com>
29 lines
1.1 KiB
TypeScript
29 lines
1.1 KiB
TypeScript
import assert from "node:assert/strict";
|
|
import test from "node:test";
|
|
import { createExternalEditTempRetention } from "./externalEditTempRetention";
|
|
|
|
test("remembers distinct temps per sftp session and forgets one session without touching others", () => {
|
|
const retention = createExternalEditTempRetention();
|
|
|
|
assert.equal(retention.remember("sftp-a", "/tmp/a.txt"), true);
|
|
assert.equal(retention.remember("sftp-a", "/tmp/a.txt"), false);
|
|
assert.equal(retention.remember("sftp-b", "/tmp/b.txt"), true);
|
|
assert.equal(retention.size, 2);
|
|
|
|
assert.equal(retention.forgetSftp("sftp-a"), true);
|
|
assert.equal(retention.size, 1);
|
|
assert.equal(retention.forgetSftp("sftp-a"), false);
|
|
assert.equal(retention.forgetPath("/tmp/b.txt"), true);
|
|
assert.equal(retention.size, 0);
|
|
});
|
|
|
|
test("clear drops every retainer after session-wide cleanup", () => {
|
|
const retention = createExternalEditTempRetention();
|
|
retention.remember("sftp-1", "/tmp/one.txt");
|
|
retention.remember("sftp-2", "/tmp/two.txt");
|
|
|
|
assert.equal(retention.clear(), true);
|
|
assert.equal(retention.size, 0);
|
|
assert.equal(retention.clear(), false);
|
|
});
|