import { describe, expect, it } from "vitest"; import { bioSegments } from "$lib/components/profile/bio"; describe("bioSegments", () => { it("splits mentions out of surrounding text", () => { expect(bioSegments("working on @tangled.org with @Alice.bsky.social.")).toEqual([ { kind: "text", text: "working on " }, { kind: "mention", handle: "tangled.org" }, { kind: "text", text: " with " }, { kind: "mention", handle: "alice.bsky.social" }, { kind: "text", text: "." } ]); }); it("leaves emails and dotless names as text", () => { expect(bioSegments("mail me@example.com or @nobody")).toEqual([ { kind: "text", text: "mail me@example.com or @nobody" } ]); }); it("keeps a mention at the very start", () => { expect(bioSegments("@eti.tngl.sh")).toEqual([{ kind: "mention", handle: "eti.tngl.sh" }]); }); });