Skip to content

Commit 5453fdf

Browse files
ly-wang19claude
andcommitted
test(line): fix lint + type-check errors in action surrogate-safe tests
- drop the unnecessary template literal (no-unnecessary-template-expression) - cast messageAction/uriAction results to { label: string } so loneHighSurrogate.test() receives a string (matches the postback/datetime test casts) Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
1 parent 9932fee commit 5453fdf

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

extensions/line/src/message-cards.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -278,10 +278,10 @@ describe("action label/data surrogate-safe truncation", () => {
278278
const loneHighSurrogate = /[\uD800-\uDBFF](?![\uDC00-\uDFFF])/;
279279
// 19 ASCII chars + 😀 (U+1F600, two UTF-16 code units) = 21 code units; a raw
280280
// .slice(0, 20) would keep the first 19 chars plus the lone high surrogate.
281-
const labelWithEmoji = `${"1234567890123456789"}😀`;
281+
const labelWithEmoji = "1234567890123456789😀";
282282

283283
it("messageAction drops a half emoji instead of leaving a lone surrogate", () => {
284-
const action = messageAction(labelWithEmoji);
284+
const action = messageAction(labelWithEmoji) as { label: string };
285285

286286
expect(action.label).toBe("1234567890123456789");
287287
expect(loneHighSurrogate.test(action.label)).toBe(false);
@@ -294,7 +294,7 @@ describe("action label/data surrogate-safe truncation", () => {
294294
});
295295

296296
it("uriAction drops a half emoji instead of leaving a lone surrogate", () => {
297-
const action = uriAction(labelWithEmoji, "https://example.com");
297+
const action = uriAction(labelWithEmoji, "https://example.com") as { label: string };
298298

299299
expect(action.label).toBe("1234567890123456789");
300300
expect(loneHighSurrogate.test(action.label)).toBe(false);

0 commit comments

Comments
 (0)