mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-10-09 15:58:34 +00:00
0d8d68d954
* fix(telnet): normalize NVT newlines * fix(telnet): handle echo negotiation * fix(telnet): align echo negotiation
22 lines
807 B
TypeScript
22 lines
807 B
TypeScript
import test from "node:test";
|
|
import assert from "node:assert/strict";
|
|
|
|
import { formatTelnetLocalEcho } from "./telnetLocalEcho";
|
|
|
|
test("formatTelnetLocalEcho echoes printable input and newlines", () => {
|
|
assert.equal(formatTelnetLocalEcho("ps\r"), "ps\r\n");
|
|
assert.equal(formatTelnetLocalEcho("one\ntwo"), "one\r\ntwo");
|
|
});
|
|
|
|
test("formatTelnetLocalEcho renders local editing control keys", () => {
|
|
assert.equal(formatTelnetLocalEcho("\x7f"), "\b \b");
|
|
assert.equal(formatTelnetLocalEcho("\b"), "\b \b");
|
|
assert.equal(formatTelnetLocalEcho("\x03"), "^C");
|
|
});
|
|
|
|
test("formatTelnetLocalEcho ignores non-display escape input", () => {
|
|
assert.equal(formatTelnetLocalEcho("\x1b[A"), "");
|
|
assert.equal(formatTelnetLocalEcho("\x1bOP"), "");
|
|
assert.equal(formatTelnetLocalEcho("\x1bb"), "");
|
|
});
|