Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.
Go dockerfossgomarkdownmemomicroblognote-takingnotesopen-sourceown-your-datareactself-hostedsqlitetimeline
import { describe, expect, it } from "vitest";
import { extractMentionUsernames } from "@/lib/memo-markdown";
describe("extractMentionUsernames", () => {
it("uses the same Markdown contexts and exact spelling as rendering", () => {
expect(
extractMentionUsernames("**@Alice** ~~@bob~~ `@code` [@link](/x)  https://example.com/@url $@math$ @Alice"),
).toEqual(["Alice", "bob"]);
});
it("keeps escapes and GFM emails opaque", () => {
expect(extractMentionUsernames("\\@escaped @[email protected] @ok")).toEqual(["ok"]);
});
it("keeps case-distinct username references distinct", () => {
expect(extractMentionUsernames("@Alice @alice @Alice")).toEqual(["Alice", "alice"]);
});
});