fix: enhance resume schema validation and improve slugify function for CJK input

This commit is contained in:
Amruth Pillai
2026-05-11 00:27:47 +02:00
parent 0abee1048c
commit 4ebe9e5a67
3 changed files with 10 additions and 4 deletions
+4
View File
@@ -50,6 +50,10 @@ describe("slugify", () => {
it("handles unicode emojis by stripping them", () => {
expect(slugify("Hello 🌍 World")).toBe("hello-world");
});
it("falls back to a non-empty slug for CJK input", () => {
expect(slugify("中文简历")).not.toBe("");
});
});
describe("getInitials", () => {
+3 -1
View File
@@ -16,7 +16,9 @@ export function generateId() {
* @returns The slugified value.
*/
export function slugify(value: string) {
return _slugify(value, { decamelize: false });
const slug = _slugify(value, { decamelize: false });
if (slug || !value.trim()) return slug;
return slugify(generateRandomName());
}
/**