generated from bastian/boilerplate
deploy
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { ApiClientService, type AdminUserDetailDto, type RoleDto } from '@boilerplate/api-client';
|
||||
import { of } from 'rxjs';
|
||||
import { AdminUserDetailPageComponent } from './admin-user-detail.page';
|
||||
|
||||
describe('AdminUserDetailPageComponent', () => {
|
||||
it('shows OIDC role provenance and does not offer local removal without a manual source', async () => {
|
||||
const adminRole = {
|
||||
id: 'admin-role',
|
||||
name: 'admin',
|
||||
description: 'Administrator',
|
||||
system: true,
|
||||
protected: true,
|
||||
roleKey: 'ADMIN',
|
||||
oidcManaged: true,
|
||||
oidcRoleName: 'hauspilot-admin',
|
||||
permissions: [],
|
||||
} satisfies RoleDto;
|
||||
const user = {
|
||||
id: 'user-1',
|
||||
name: 'Bastian',
|
||||
email: 'admin@example.test',
|
||||
active: true,
|
||||
roles: [{ id: adminRole.id, name: 'admin', system: true, sources: ['OIDC'] }],
|
||||
lastLoginAt: '2026-07-20',
|
||||
createdAt: '2026-07-20',
|
||||
activeSessionCount: 0,
|
||||
effectivePermissions: [],
|
||||
sessions: [],
|
||||
} satisfies AdminUserDetailDto;
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [AdminUserDetailPageComponent],
|
||||
providers: [
|
||||
{ provide: ActivatedRoute, useValue: { snapshot: { paramMap: { get: () => user.id } } } },
|
||||
{
|
||||
provide: ApiClientService,
|
||||
useValue: { adminRoles: () => of([adminRole]), adminUser: () => of(user) },
|
||||
},
|
||||
],
|
||||
}).compileComponents();
|
||||
const fixture = TestBed.createComponent(AdminUserDetailPageComponent);
|
||||
fixture.detectChanges();
|
||||
const host = fixture.nativeElement as HTMLElement;
|
||||
|
||||
expect(host.textContent).toContain('Herkunft: OIDC');
|
||||
expect(host.textContent).toContain('Entfernen Sie die externe Rolle im Identity Provider');
|
||||
expect(host.textContent).not.toContain('Manuelle Zuweisung entfernen');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user