feat: First-Start Create Admin Modal 1.00

This commit is contained in:
OpenVelo Agent
2026-07-21 15:07:42 +00:00
parent a3ea62640d
commit b315f8f7fc
12 changed files with 374 additions and 99 deletions
+27
View File
@@ -0,0 +1,27 @@
import { decideAdminGuard } from '../../frontend/src/app/core/guards/admin.guard.decision';
describe('decideAdminGuard', () => {
it('redirects to /bootstrap when not initialized', () => {
expect(
decideAdminGuard({ initialized: false, isAuthenticated: true, role: 'admin' }),
).toEqual({ kind: 'redirect', path: '/bootstrap' });
});
it('redirects to /login when not authenticated', () => {
expect(
decideAdminGuard({ initialized: true, isAuthenticated: false, role: undefined }),
).toEqual({ kind: 'redirect', path: '/login' });
});
it('redirects to / when authenticated but not admin', () => {
expect(
decideAdminGuard({ initialized: true, isAuthenticated: true, role: 'player' }),
).toEqual({ kind: 'redirect', path: '/' });
});
it('allows when authenticated admin', () => {
expect(
decideAdminGuard({ initialized: true, isAuthenticated: true, role: 'admin' }),
).toEqual({ kind: 'allow' });
});
});
+15
View File
@@ -0,0 +1,15 @@
import { shouldShowAdminNav } from '../../frontend/src/app/features/home/home.shell';
describe('shouldShowAdminNav', () => {
it('shows admin nav when authenticated and role is admin', () => {
expect(shouldShowAdminNav({ isAuthenticated: true, role: 'admin' })).toBe(true);
});
it('hides admin nav when not authenticated', () => {
expect(shouldShowAdminNav({ isAuthenticated: false, role: undefined })).toBe(false);
});
it('hides admin nav for player role', () => {
expect(shouldShowAdminNav({ isAuthenticated: true, role: 'player' })).toBe(false);
});
});