test(260928-ujj): rote Tests fuer Dashboard-Hintergrund in der Datenbank

- PATCH me/dashboard-background: Allowlist, UUID-Bildkennung, Mandantenbindung
- getMe liefert dashboardBackground normalisiert
- Web: Uebernahme der alten localStorage-Wahl, Hook liest aus dem Auth-Store

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-28 22:08:00 +02:00
parent 9fa0a3f498
commit 76f6d87973
5 changed files with 299 additions and 31 deletions
+29
View File
@@ -49,6 +49,7 @@ interface FakeUserRow {
mustChangePassword: boolean;
avatarPath?: string | null;
accentColor?: string | null;
dashboardBackground?: unknown;
}
interface BoundCall {
@@ -501,6 +502,8 @@ describe('AuthService.getMe', () => {
mustChangePassword: false,
avatarPath: 'avatars/u1.png',
accentColor: '#3b82f6',
// quick-260928-ujj: gespeicherter Zusatzschluessel wird bei der Ausgabe verworfen.
dashboardBackground: { kind: 'preset', id: 'dunes', extra: 'weg' },
};
const ldapUserRow: FakeUserRow = {
@@ -515,6 +518,7 @@ describe('AuthService.getMe', () => {
mustChangePassword: false,
avatarPath: null,
accentColor: null,
dashboardBackground: null,
};
beforeEach(() => {
@@ -535,6 +539,7 @@ describe('AuthService.getMe', () => {
tenantId: 't1',
mustChangePassword: false,
accentColor: '#3b82f6',
dashboardBackground: { kind: 'preset', id: 'dunes' },
isLocalUser: true,
hasAvatar: true,
});
@@ -549,6 +554,30 @@ describe('AuthService.getMe', () => {
expect(result).toMatchObject({ isLocalUser: false, hasAvatar: false });
});
it('quick-260928-ujj: dashboardBackground NULL (nie gewaehlt) kommt als null zurueck', async () => {
const result = await service.getMe('t1', 'u2');
expect(result).toHaveProperty('dashboardBackground', null);
});
it('quick-260928-ujj: ungueltiger gespeicherter Hintergrund kommt als null zurueck (T-ujj-01)', async () => {
prisma.__users.set('u1', {
...prisma.__users.get('u1'),
dashboardBackground: { kind: 'image', imageId: '") ; background: url("x' },
});
const result = await service.getMe('t1', 'u1');
expect(result).toHaveProperty('dashboardBackground', null);
});
it('quick-260928-ujj: dashboardBackground steht im select neben accentColor', async () => {
await service.getMe('t1', 'u1');
const call = prisma.__boundCallLog.find((c: any) => c.method === 'findUnique');
expect(call.args.select).toMatchObject({ accentColor: true, dashboardBackground: true });
});
it('FREMDER Mandant (Klient unter t2, Zeile unter t1): liefert null, kein Fehler', async () => {
const result = await service.getMe('t2', 'u1');