Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

textGenerationUtils.test.ts

16 lines706 Bytes

1import { describe, expect, it } from "vite-plus/test";
2​
3import { sanitizeCommitSubject } from "./textGenerationUtils.ts";
4​
5describe("sanitizeCommitSubject", () => {
6 // regression: #19181 truncation split grapheme clusters at the subject limit
7 it.each([
8 { name: "an emoji", prefixLength: 71, character: "πŸš€" },
9 { name: "an accented character", prefixLength: 71, character: "e\u0301" },
10 { name: "a joined emoji", prefixLength: 65, character: "πŸ‘¨β€πŸ‘©β€πŸ‘§β€πŸ‘¦" },
11 ])("keeps $name intact at the subject limit", ({ prefixLength, character }) => {
12 const prefix = "a".repeat(prefixLength);
13​
14 expect(sanitizeCommitSubject(`${prefix}${character} more`)).toBe(prefix);
15 });
16});