Skip to content

Commit 84f00be

Browse files
committed
test(auto-reply): cover label surrogate boundary
1 parent 068c124 commit 84f00be

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

src/auto-reply/reply/conversation-label-generator.test.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,4 +197,19 @@ describe("generateConversationLabel", () => {
197197
}),
198198
).resolves.toBe("A very long ");
199199
});
200+
201+
it("keeps the label on a UTF-16 boundary", async () => {
202+
completeWithPreparedSimpleCompletionModel.mockResolvedValue({
203+
content: [{ type: "text", text: `${"a".repeat(127)}🚀tail` }],
204+
});
205+
206+
await expect(
207+
generateConversationLabel({
208+
userMessage: "Need help with invoices",
209+
prompt: "Generate a label",
210+
cfg: {},
211+
maxLength: 128,
212+
}),
213+
).resolves.toBe("a".repeat(127));
214+
});
200215
});

0 commit comments

Comments
 (0)