Keep # in in-game names when dropping the discriminator

This commit is contained in:
Kalle
2026-11-05 19:43:42 +02:00
parent 781e239645
commit 1ca684fdf4
8 changed files with 78 additions and 8 deletions

View File

@@ -1,10 +1,29 @@
import { describe, expect, test } from "vitest";
import {
inGameNameWithoutDiscriminator,
pathnameFromPotentialURL,
removeMarkdown,
truncateBySentence,
} from "./strings";
describe("inGameNameWithoutDiscriminator()", () => {
test.each([
{ why: "plain name", inGameName: "Sendou#1234", expected: "Sendou" },
{
why: "# inside the name",
inGameName: "Brook #4#2564",
expected: "Brook #4",
},
{
why: "name starting with #",
inGameName: "# Sowoul ##1013",
expected: "# Sowoul #",
},
])("keeps the name of $why", ({ inGameName, expected }) => {
expect(inGameNameWithoutDiscriminator(inGameName)).toBe(expected);
});
});
describe("pathnameFromPotentialURL()", () => {
test("Resolves path name from valid URL", () => {
expect(pathnameFromPotentialURL("https://bsky.app/sendouc")).toBe(