Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

test(core): add unit tests for reserved-slugs (#2985)

Tom Qiao81e8aa581214
diff --git a/packages/core/paths/reserved-slugs.test.ts b/packages/core/paths/reserved-slugs.test.ts
new file mode 100644
index 0000000000..bac2518d0a
--- /dev/null
+++ b/packages/core/paths/reserved-slugs.test.ts
@@ -0,0 +1,30 @@
+import { describe, expect, it } from "vitest";
+import { RESERVED_SLUGS, isReservedSlug } from "./reserved-slugs";
+
+describe("reserved slugs", () => {
+ it("returns true for a known reserved slug", () => {
+ expect(isReservedSlug("login")).toBe(true);
+ });
+
+ it("returns false for an unreserved slug", () => {
+ expect(isReservedSlug("my-cool-workspace")).toBe(false);
+ });
+
+ it("returns false for an empty slug", () => {
+ expect(isReservedSlug("")).toBe(false);
+ });
+
+ it("exposes a non-empty reserved slug set", () => {
+ expect(RESERVED_SLUGS.size).toBeGreaterThan(0);
+ });
+
+ it("keeps the set and predicate consistent", () => {
+ for (const slug of RESERVED_SLUGS) {
+ expect(isReservedSlug(slug)).toBe(true);
+ }
+ });
+
+ it("matches slugs case-sensitively", () => {
+ expect(isReservedSlug("Login")).toBe(false);
+ });
+});