import { describe, expect, test } from 'vitest'; import { isPublicRoute } from './publicRoutes'; describe('isPublicRoute', () => { test('/login is public — login form must render to unauthenticated visitors', () => { expect(isPublicRoute('/login')).toBe(true); }); // Regression guard for #376: /register was previously bounced to /login // by the layout guard, breaking bootstrap-admin self-registration on // fresh deployments. Do NOT remove /register from the public set unless // you have a deliberate replacement (e.g. invite-only landing page). test('/register is public — bootstrap admin must reach the form', () => { expect(isPublicRoute('/register')).toBe(true); }); test('/ is gated', () => { expect(isPublicRoute('/')).toBe(false); }); test('/admin/users is gated', () => { expect(isPublicRoute('/admin/users')).toBe(false); }); test('/settings is gated', () => { expect(isPublicRoute('/settings')).toBe(false); }); test('paths that merely start with /login are not public', () => { expect(isPublicRoute('/login/extra')).toBe(false); expect(isPublicRoute('/loginx')).toBe(false); }); });