feat(dashboard): activate routed media filters
This commit is contained in:
1 parent
d108903174
commit
66a1146562
2 files changed
+48
-2
No files matched your search
@@ -91,6 +91,52 @@ describe('dashboard foundation', () => {
|
||||
expect(screen.getByRole('heading', { name: 'Operations' })).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('hydrates media filters from the routed URL', async () => {
|
||||
installSuccessfulApi();
|
||||
server.use(
|
||||
http.get('/api/media', () => HttpResponse.json([{
|
||||
id: 'media-1',
|
||||
chatUsername: 'alice',
|
||||
chatRoomId: 'room-1',
|
||||
sender: 'alice',
|
||||
timestamp: Date.now(),
|
||||
originalUrl: 'https://example.test/reaction.gif',
|
||||
fileName: 'reaction.gif',
|
||||
relativePath: 'reaction.gif',
|
||||
createdAt: Date.now(),
|
||||
urlPath: '/media/reaction.gif',
|
||||
}])),
|
||||
http.get('/api/media/sync', () => HttpResponse.json({
|
||||
isSyncing: false,
|
||||
lastSyncAt: null,
|
||||
lastSyncDurationMs: null,
|
||||
lastSyncChats: null,
|
||||
lastError: null,
|
||||
nextSyncAt: null,
|
||||
})),
|
||||
http.get('/api/login/status', () => HttpResponse.json({
|
||||
ready: true,
|
||||
loggedIn: true,
|
||||
status: 'authenticated',
|
||||
})),
|
||||
http.get('/api/chats/sync', () => HttpResponse.json({
|
||||
syncing: false,
|
||||
syncingKind: null,
|
||||
lastFullSyncAt: null,
|
||||
lastDeltaSyncAt: null,
|
||||
hasEverFullSynced: false,
|
||||
cachedChats: 0,
|
||||
progress: null,
|
||||
})),
|
||||
);
|
||||
|
||||
renderDashboard('/media?conversation=alice&type=gif&range=7d');
|
||||
|
||||
expect(await screen.findByRole('combobox', { name: 'Conversation' })).toHaveValue('alice');
|
||||
expect(screen.getByRole('combobox', { name: 'Media type' })).toHaveValue('gif');
|
||||
expect(screen.getByRole('combobox', { name: 'Date range' })).toHaveValue('7d');
|
||||
});
|
||||
|
||||
it('shows loading then renders stats, timers, and an explicit empty activity state', async () => {
|
||||
let resolveStats: ((response: Response) => void) | undefined;
|
||||
server.use(
|
||||
|
||||
Reference in new issue
Block a user