test(260805-d0r): add failing test for MANUAL/LDAP origin badge on chips

This commit is contained in:
2026-08-05 09:36:45 +02:00
parent f8ff74bd3f
commit 73122b5676
@@ -23,6 +23,10 @@ const messages: Record<string, Record<string, unknown>> = {
'{module} direkt für {user} {granted, select, true {freigeben} other {entziehen}}',
saveError: 'Freigabe konnte nicht gespeichert werden. Bitte erneut versuchen.',
},
'admin.groups.members': {
sourceManual: 'Manuell',
sourceLdap: 'LDAP',
},
common: {
loading: 'Laden...',
close: 'Schliessen',
@@ -252,4 +256,32 @@ describe('UserAccessModal', () => {
expect(box).toHaveAccessibleName();
}
});
it('shows the LDAP origin badge on a chip with source LDAP and the Manuell badge on source MANUAL', async () => {
vi.stubGlobal(
'fetch',
vi.fn(() =>
Promise.resolve({
ok: true,
json: () =>
Promise.resolve({
groups: [
{ id: 'g1', name: 'Manuelle Gruppe', source: 'MANUAL' as const },
{ id: 'g2', name: 'LDAP-Gruppe', source: 'LDAP' as const },
],
modules: [],
}),
}),
),
);
render(<UserAccessModal userId="u1" username="Maxi Musterfrau" onClose={vi.fn()} />);
await waitFor(() => {
expect(screen.getByText('Manuelle Gruppe')).toBeInTheDocument();
});
expect(screen.getByText('LDAP-Gruppe')).toBeInTheDocument();
expect(screen.getByText('Manuell')).toBeInTheDocument();
expect(screen.getByText('LDAP')).toBeInTheDocument();
});
});