AI Implementation feature(842): First-Start Create Admin Modal 1.01 (#4)

This commit was merged in pull request #4.
This commit is contained in:
2026-07-21 15:32:51 +00:00
parent 960516a7bc
commit 6feaf08bdb
17 changed files with 834 additions and 217 deletions
@@ -0,0 +1,39 @@
import { decideAuthRedirect } from '../../frontend/src/app/core/guards/auth.guard.decision';
function makeRouter() {
return {
createUrlTree: jest.fn((cmds: string[]) => ({ __urlTree: true, cmds })),
};
}
describe('decideAuthRedirect (race-fix core)', () => {
it('redirects to /bootstrap while bootstrap is uninitialized', () => {
const router = makeRouter();
const result = decideAuthRedirect(
{ initialized: false, isAuthenticated: false },
router as any,
);
expect(router.createUrlTree).toHaveBeenCalledWith(['/bootstrap']);
expect((result as any).__urlTree).toBe(true);
});
it('redirects to /login when initialized but not authenticated', () => {
const router = makeRouter();
const result = decideAuthRedirect(
{ initialized: true, isAuthenticated: false },
router as any,
);
expect(router.createUrlTree).toHaveBeenCalledWith(['/login']);
expect((result as any).__urlTree).toBe(true);
});
it('allows navigation when initialized AND authenticated (no /bootstrap redirect)', () => {
const router = makeRouter();
const result = decideAuthRedirect(
{ initialized: true, isAuthenticated: true },
router as any,
);
expect(result).toBe(true);
expect(router.createUrlTree).not.toHaveBeenCalled();
});
});