feat(portal-self-service): implement the DigiD registration submit page (refs #67)
RegistrationPage shows the signed-in BSN and submits to the BFF via the generated api-client, confirming with the returned reference; built from NL Design System (Utrecht) components. Wire the guarded route + app providers (DigiD OIDC + token interceptor + HttpClient), the NL DS theme, and lang=nl. Component tests (Testing Library) + axe (WCAG 2.1 AA) pass; a guard test covers libs/auth. Replace the demo eslint depConstraints (scope:shop/shared) with a permissive default. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
42
libs/auth/src/lib/authenticated.guard.spec.ts
Normal file
42
libs/auth/src/lib/authenticated.guard.spec.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
import { signal } from '@angular/core';
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { AuthService } from './auth.service';
|
||||
import { authenticatedGuard } from './authenticated.guard';
|
||||
|
||||
class FakeAuth extends AuthService {
|
||||
readonly isAuthenticated = signal(false);
|
||||
readonly bsn = signal<string | undefined>(undefined);
|
||||
login(): void {
|
||||
/* spied in tests */
|
||||
}
|
||||
logout(): void {
|
||||
/* noop */
|
||||
}
|
||||
}
|
||||
|
||||
function runGuard(authenticated: boolean) {
|
||||
const auth = new FakeAuth();
|
||||
auth.isAuthenticated.set(authenticated);
|
||||
const loginSpy = vi.spyOn(auth, 'login');
|
||||
TestBed.configureTestingModule({
|
||||
providers: [{ provide: AuthService, useValue: auth }],
|
||||
});
|
||||
const result = TestBed.runInInjectionContext(() =>
|
||||
authenticatedGuard(null as never, null as never),
|
||||
);
|
||||
return { result, loginSpy };
|
||||
}
|
||||
|
||||
describe('authenticatedGuard', () => {
|
||||
it('allows the route for an authenticated user', () => {
|
||||
const { result, loginSpy } = runGuard(true);
|
||||
expect(result).toBe(true);
|
||||
expect(loginSpy).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('blocks and starts DigiD login when not authenticated', () => {
|
||||
const { result, loginSpy } = runGuard(false);
|
||||
expect(result).toBe(false);
|
||||
expect(loginSpy).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
});
|
||||
@@ -1,10 +1,17 @@
|
||||
// NL Design System building blocks — Utrecht is NL DS's reference Angular implementation
|
||||
// (docs/frontend-decisions.md). The portals depend on the design system through this one lib.
|
||||
// The design tokens/theme CSS is imported once, at the app level (apps/*/src/styles.css).
|
||||
//
|
||||
// The Utrecht v3 components are NgModule-based (not standalone), so we re-export the module.
|
||||
// A standalone component consumes them by importing UtrechtComponentsModule in its `imports`
|
||||
// (CLAUDE.md §10 forbids *declaring* NgModules in our code, not consuming a third-party one).
|
||||
// The component classes are re-exported too so the AOT compiler can resolve the template
|
||||
// directives (utrecht-article, utrecht-button, …) through this barrel.
|
||||
export {
|
||||
UtrechtArticle,
|
||||
UtrechtButtonAttr,
|
||||
UtrechtComponentsModule,
|
||||
UtrechtDocument,
|
||||
UtrechtHeading,
|
||||
UtrechtHeading1,
|
||||
UtrechtParagraph,
|
||||
} from '@utrecht/component-library-angular';
|
||||
|
||||
7
libs/ui/src/lib/ui.spec.ts
Normal file
7
libs/ui/src/lib/ui.spec.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { UtrechtComponentsModule } from '../index';
|
||||
|
||||
describe('ui barrel', () => {
|
||||
it('re-exports the NL Design System (Utrecht) module', () => {
|
||||
expect(UtrechtComponentsModule).toBeTruthy();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user