Skip to content

Commit 90358d9

Browse files
committed
test(cron): cover UTF-16 diagnostic boundaries
1 parent bcb72bc commit 90358d9

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

src/cron/run-diagnostics.test.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,29 @@ describe("cron run diagnostics", () => {
3131
expect(diagnostics?.summary).toHaveLength(2_000);
3232
});
3333

34+
it("keeps bounded diagnostic text valid at UTF-16 boundaries", () => {
35+
const diagnostics = normalizeCronRunDiagnostics({
36+
summary: `${"s".repeat(1_998)}😀tail`,
37+
entries: [
38+
{
39+
ts: 1,
40+
source: "exec",
41+
severity: "error",
42+
message: `${"m".repeat(998)}😀tail`,
43+
},
44+
],
45+
});
46+
47+
expect(diagnostics?.summary).toBe(`${"s".repeat(1_998)}…`);
48+
expect(diagnostics?.entries[0]).toEqual({
49+
ts: 1,
50+
source: "exec",
51+
severity: "error",
52+
message: `${"m".repeat(998)}…`,
53+
truncated: true,
54+
});
55+
});
56+
3457
it("preserves later terminal diagnostics when capping entries", () => {
3558
const diagnostics = normalizeCronRunDiagnostics({
3659
entries: [

0 commit comments

Comments
 (0)