memos/web/tests/remark-mention.test.ts
johnnyjoygh 84776cc106 fix(api): align resource IDs with AIP conventions
Validate new user-provided IDs using the AIP-122 format while retaining legacy UID compatibility. Correct resource annotations and canonical names returned by user stats.
2026-07-18 11:12:28 +08:00

14 lines
576 B
TypeScript

import { describe, expect, it } from "vitest";
import { parseMentionsFromText } from "@/utils/remark-plugins/remark-mention";
describe("parseMentionsFromText", () => {
it("accepts a 63-character username", () => {
const username = `a${"b".repeat(62)}`;
expect(parseMentionsFromText(`@${username}`)).toEqual([{ type: "mention", value: username }]);
});
it("leaves a 64-character username as text", () => {
const username = `a${"b".repeat(63)}`;
expect(parseMentionsFromText(`@${username}`)).toEqual([{ type: "text", value: `@${username}` }]);
});
});