mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-23 16:42:19 +00:00
* fix(#3398): automated AI fix * fix: address Codex review on PR #3400 * fix: address Codex review on PR #3400 * fix: address Codex review on PR #3400 * fix: address Codex review on PR #3400 * fix: address Codex review on PR #3400 * fix: address Codex review on PR #3400 * fix: address Codex review on PR #3400 * fix: address Codex review on PR #3400 * fix: address Codex review on PR #3400 * fix: address Codex review on PR #3400 * fix(terminal): protect popup and sanitized multiline pastes * fix(terminal): preserve input state across paste confirmation * fix(terminal): retain serial character-mode paste echo * test(terminal): cover paced input write options * fix(terminal): retain telnet echo for paced pastes * test(terminal): scope serial buffer assertion to serial sessions * fix(terminal): align runtime write options with bridge contract * fix(terminal): preserve bookkeeping for all paced pastes * fix(terminal): record confirmed paste lines in order * fix: record paced paste commands after transport writes * fix: omit paste receipts for filtered input * fix: cancel superseded paste batches across input paths * fix: classify each acknowledged paste line before recording * fix: stop paced paste when editing buffered serial input * fix: preserve recording pause boundaries and serial edit cancellation * fix: treat paced terminal pastes as user input * fix: preserve paste drafts until write and snippet broadcast origin * fix: retain filtered paste drafts and invalidate urgent input ownership * fix: broadcast paced user paste only on guarded line receipts --------- Co-authored-by: netcatty-bot <308658023+netcatty-bot@users.noreply.github.com> Co-authored-by: bincxz <16399091+binaricat@users.noreply.github.com>
41 lines
1.7 KiB
TypeScript
41 lines
1.7 KiB
TypeScript
import test from "node:test";
|
|
import assert from "node:assert/strict";
|
|
|
|
import {
|
|
getMultilinePasteInfo,
|
|
normalizeMultilinePasteConfirmMinLines,
|
|
shouldConfirmMultilinePaste,
|
|
} from "./terminalPasteConfirm";
|
|
|
|
test("line count ignores a single trailing newline", () => {
|
|
assert.equal(getMultilinePasteInfo("line1\nline2\n").lineCount, 2);
|
|
assert.equal(getMultilinePasteInfo("line1\n").lineCount, 1);
|
|
assert.equal(getMultilinePasteInfo("").lineCount, 0);
|
|
});
|
|
|
|
test("line count normalizes CRLF and CR line endings", () => {
|
|
assert.equal(getMultilinePasteInfo("line1\r\nline2\rline3\n").lineCount, 3);
|
|
assert.equal(getMultilinePasteInfo("a\r\nb\nc").charCount, 6);
|
|
});
|
|
|
|
test("default threshold asks for confirmation at 2+ lines", () => {
|
|
assert.equal(shouldConfirmMultilinePaste("single"), false);
|
|
assert.equal(shouldConfirmMultilinePaste("line1\n"), false);
|
|
assert.equal(shouldConfirmMultilinePaste("line1\nline2"), true);
|
|
assert.equal(shouldConfirmMultilinePaste("line1\r\nline2\r\nline3"), true);
|
|
});
|
|
|
|
test("configurable threshold is honored", () => {
|
|
assert.equal(shouldConfirmMultilinePaste("line1\nline2", { minLines: 3 }), false);
|
|
assert.equal(shouldConfirmMultilinePaste("line1\nline2\nline3", { minLines: 3 }), true);
|
|
});
|
|
|
|
test("threshold normalization clamps to the supported range", () => {
|
|
assert.equal(normalizeMultilinePasteConfirmMinLines(undefined), 2);
|
|
assert.equal(normalizeMultilinePasteConfirmMinLines(0), 1);
|
|
assert.equal(normalizeMultilinePasteConfirmMinLines(-5), 1);
|
|
assert.equal(normalizeMultilinePasteConfirmMinLines(2000), 1000);
|
|
assert.equal(normalizeMultilinePasteConfirmMinLines(Number.NaN), 2);
|
|
assert.equal(normalizeMultilinePasteConfirmMinLines(10.4), 10);
|
|
});
|