I finished the remaining polish so the admin app now feels fully “app‑like” across the core screens.

This commit is contained in:
Codex Agent
2025-12-28 20:48:32 +01:00
parent d3b6c6c029
commit 1e0c38fce4
23 changed files with 1250 additions and 112 deletions

View File

@@ -0,0 +1,33 @@
import { describe, expect, it } from 'vitest';
import { groupNotificationsByScope, type NotificationScope } from './notificationGrouping';
type Item = { id: string; scope: NotificationScope; is_read?: boolean };
describe('groupNotificationsByScope', () => {
it('groups items and counts unread', () => {
const items: Item[] = [
{ id: '1', scope: 'photos', is_read: false },
{ id: '2', scope: 'photos', is_read: true },
{ id: '3', scope: 'package', is_read: false },
];
const grouped = groupNotificationsByScope(items);
expect(grouped[0]?.scope).toBe('photos');
expect(grouped[0]?.items).toHaveLength(2);
expect(grouped[0]?.unread).toBe(1);
expect(grouped[1]?.scope).toBe('package');
expect(grouped[1]?.unread).toBe(1);
});
it('sorts groups by predefined scope order', () => {
const items: Item[] = [
{ id: '1', scope: 'general', is_read: true },
{ id: '2', scope: 'events', is_read: true },
{ id: '3', scope: 'photos', is_read: true },
];
const grouped = groupNotificationsByScope(items);
expect(grouped.map((group) => group.scope)).toEqual(['photos', 'events', 'general']);
});
});