* Add admin users management page with pagination, search, and inline username editing https://claude.ai/code/session_01E4UUQqQedhFP2F5YcBRArs * Fix five issues from admin users page code review - admin.users: use useEffect to close inline edit on success so validation errors are not silently discarded when the save button fires onClick - root: add /admin to ONBOARDING_EXEMPT so admin users without a username are not redirect-looped away from admin pages - settings: skip username validation when the username field is empty so updating timezone alone does not break for accounts without a username - models/user: exclude soft-deleted users from findUsersPaginated - admin.users: remove unused hasMore from loader return; simplify header div https://claude.ai/code/session_01E4UUQqQedhFP2F5YcBRArs * Fix lint: rename shadowed variables in user model - findUserByUsername: use imported sql directly instead of destructuring it from the callback (shadowed the top-level import) - findUsersPaginated: rename orderBy callback param from users to t (shadowed the outer users result variable) https://claude.ai/code/session_01E4UUQqQedhFP2F5YcBRArs --------- Co-authored-by: Claude <noreply@anthropic.com>
47 lines
1.8 KiB
TypeScript
47 lines
1.8 KiB
TypeScript
import { describe, it, expect } from "vitest";
|
|
import { isOnboardingExempt } from "../../root";
|
|
|
|
describe("isOnboardingExempt", () => {
|
|
it("exempts /onboarding exactly", () => {
|
|
expect(isOnboardingExempt("/onboarding")).toBe(true);
|
|
});
|
|
|
|
it("exempts /onboarding sub-paths", () => {
|
|
expect(isOnboardingExempt("/onboarding/step2")).toBe(true);
|
|
});
|
|
|
|
it("exempts /api/ prefix paths", () => {
|
|
expect(isOnboardingExempt("/api/auth/callback")).toBe(true);
|
|
expect(isOnboardingExempt("/api/draft/start")).toBe(true);
|
|
});
|
|
|
|
it("does not exempt paths that merely start with /api without trailing slash", () => {
|
|
// /api/ has a trailing slash so startsWith("/api/") is used — /apiary would not match
|
|
expect(isOnboardingExempt("/apiary")).toBe(false);
|
|
});
|
|
|
|
it("exempts auth pages exactly", () => {
|
|
expect(isOnboardingExempt("/login")).toBe(true);
|
|
expect(isOnboardingExempt("/register")).toBe(true);
|
|
expect(isOnboardingExempt("/check-email")).toBe(true);
|
|
expect(isOnboardingExempt("/forgot-password")).toBe(true);
|
|
expect(isOnboardingExempt("/reset-password")).toBe(true);
|
|
});
|
|
|
|
it("does not exempt a path that merely starts with an exempt path without slash", () => {
|
|
expect(isOnboardingExempt("/registered-user")).toBe(false);
|
|
expect(isOnboardingExempt("/loginpage")).toBe(false);
|
|
});
|
|
|
|
it("exempts /admin and all sub-paths", () => {
|
|
expect(isOnboardingExempt("/admin")).toBe(true);
|
|
expect(isOnboardingExempt("/admin/users")).toBe(true);
|
|
expect(isOnboardingExempt("/admin/sports-seasons/123")).toBe(true);
|
|
});
|
|
|
|
it("does not exempt normal app routes", () => {
|
|
expect(isOnboardingExempt("/")).toBe(false);
|
|
expect(isOnboardingExempt("/leagues/abc")).toBe(false);
|
|
expect(isOnboardingExempt("/settings")).toBe(false);
|
|
});
|
|
});
|