mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-15 00:46:06 +00:00
* fix(infra): preserve bounded response text characters Co-authored-by: qingminlong <34085845+qingminglong@users.noreply.github.com> * ci(plugin-sdk): refresh API baseline --------- Co-authored-by: qingminlong <34085845+qingminglong@users.noreply.github.com>
19 lines
640 B
TypeScript
19 lines
640 B
TypeScript
import { describe, expect, it } from "vitest";
|
||
import { decodeTextPrefix } from "./text-decoding.js";
|
||
|
||
describe("decodeTextPrefix", () => {
|
||
const encoded = new TextEncoder().encode("ab😀cd");
|
||
|
||
it("decodes complete text normally", () => {
|
||
expect(decodeTextPrefix(encoded)).toBe("ab😀cd");
|
||
});
|
||
|
||
it("drops an incomplete trailing sequence from a truncated prefix", () => {
|
||
expect(decodeTextPrefix(encoded.subarray(0, 3), { truncated: true })).toBe("ab");
|
||
});
|
||
|
||
it("preserves normal replacement behavior for a complete malformed body", () => {
|
||
expect(decodeTextPrefix(encoded.subarray(0, 3))).toBe("ab<61>");
|
||
});
|
||
});
|