Add endpoint for deleting raw packets of decrypted messages

This commit is contained in:
Jack Kingsman
2026-02-21 00:10:29 -08:00
parent 6d0505ade6
commit 11f07f3501
6 changed files with 135 additions and 13 deletions
+17
View File
@@ -15,6 +15,7 @@ import {
LAST_VIEWED_CONVERSATION_KEY,
REOPEN_LAST_CONVERSATION_KEY,
} from '../utils/lastViewedConversation';
import { api } from '../api';
const baseConfig: RadioConfig = {
public_key: 'aa'.repeat(32),
@@ -321,6 +322,22 @@ describe('SettingsModal', () => {
expect(localStorage.getItem(LAST_VIEWED_CONVERSATION_KEY)).toBeNull();
});
it('purges decrypted raw packets via maintenance endpoint action', async () => {
const runMaintenanceSpy = vi.spyOn(api, 'runMaintenance').mockResolvedValue({
packets_deleted: 12,
vacuumed: true,
});
renderModal();
openDatabaseSection();
fireEvent.click(screen.getByRole('button', { name: 'Purge Decrypted Raw Packets' }));
await waitFor(() => {
expect(runMaintenanceSpy).toHaveBeenCalledWith({ purgeLinkedRawPackets: true });
});
});
it('renders statistics section with fetched data', async () => {
const mockStats: StatisticsResponse = {
busiest_channels_24h: [