AI Implementation feature(823): Landing Page and Login/Register Modal (#11)
This commit was merged in pull request #11.
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import { decideLandingGuard } from '../../frontend/src/app/core/guards/landing.guard.decision';
|
||||
|
||||
describe('decideLandingGuard', () => {
|
||||
const router = {
|
||||
createUrlTree: jest.fn((commands: string[]) => ({ kind: 'UrlTree', commands })),
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
(router.createUrlTree as jest.Mock).mockClear();
|
||||
});
|
||||
|
||||
it('redirects to /bootstrap when not initialized', () => {
|
||||
const r = decideLandingGuard({ initialized: false, isAuthenticated: false }, router as any);
|
||||
expect(router.createUrlTree).toHaveBeenCalledWith(['/bootstrap']);
|
||||
expect((r as any).commands).toEqual(['/bootstrap']);
|
||||
});
|
||||
|
||||
it('redirects to / when initialized and authenticated', () => {
|
||||
const r = decideLandingGuard({ initialized: true, isAuthenticated: true }, router as any);
|
||||
expect(router.createUrlTree).toHaveBeenCalledWith(['/']);
|
||||
expect((r as any).commands).toEqual(['/']);
|
||||
});
|
||||
|
||||
it('allows when initialized and not authenticated', () => {
|
||||
expect(decideLandingGuard({ initialized: true, isAuthenticated: false }, router as any)).toBe(true);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user