sendou.ink/app/utils/urls.test.ts
Kalle e06f7177dd
Some checks are pending
E2E Tests / e2e (push) Waiting to run
Tests and checks on push / run-checks-and-tests (push) Waiting to run
Updates translation progress / update-translation-progress-issue (push) Waiting to run
Fix more various small bugs
2026-06-09 21:52:26 +03:00

40 lines
1.1 KiB
TypeScript

import { describe, expect, it } from "vitest";
import {
leaderboardsPage,
tournamentOrganizationPage,
userArtPage,
} from "./urls";
describe("leaderboardsPage()", () => {
it("encodes season 0 in the query string", () => {
const url = leaderboardsPage({ season: 0, type: "USER" });
const params = new URLSearchParams(url.split("?")[1]);
expect(params.get("season")).toBe("0");
});
});
describe("userArtPage()", () => {
it("joins source and bigArtId params with a single query string", () => {
const url = userArtPage({ discordId: "123" }, "MADE-BY", 456);
const params = new URLSearchParams(url.split("?")[1]);
expect(params.get("source")).toBe("MADE-BY");
expect(params.get("big")).toBe("456");
});
});
describe("tournamentOrganizationPage()", () => {
it("round-trips the tournament name through the source param", () => {
const tournamentName = "100% Series";
const url = tournamentOrganizationPage({
organizationSlug: "sendou",
tournamentName,
});
const params = new URLSearchParams(url.split("?")[1]);
expect(params.get("source")).toBe(tournamentName);
});
});