Add statistics

This commit is contained in:
Jack Kingsman
2026-03-07 23:17:10 -08:00
parent 20af50585b
commit b3625b4937
6 changed files with 189 additions and 1 deletions
+26
View File
@@ -378,6 +378,15 @@ describe('SettingsModal', () => {
total_outgoing: 30,
contacts_heard: { last_hour: 2, last_24_hours: 7, last_week: 10 },
repeaters_heard: { last_hour: 1, last_24_hours: 3, last_week: 3 },
path_hash_width_24h: {
total_packets: 120,
single_byte: 60,
double_byte: 36,
triple_byte: 24,
single_byte_pct: 50,
double_byte_pct: 30,
triple_byte_pct: 20,
},
};
vi.spyOn(globalThis, 'fetch').mockResolvedValue(
@@ -405,6 +414,14 @@ describe('SettingsModal', () => {
expect(screen.getByText('Total stored')).toBeInTheDocument();
expect(screen.getByText('Decrypted')).toBeInTheDocument();
expect(screen.getByText('Undecrypted')).toBeInTheDocument();
expect(screen.getByText('Path Hash Width (24h)')).toBeInTheDocument();
expect(
screen.getByText(/Parsed stored raw packets from the last 24 hours: 120/)
).toBeInTheDocument();
expect(screen.getByText('1-byte hops')).toBeInTheDocument();
expect(screen.getByText('60 (50.0%)')).toBeInTheDocument();
expect(screen.getByText('36 (30.0%)')).toBeInTheDocument();
expect(screen.getByText('24 (20.0%)')).toBeInTheDocument();
expect(screen.getByText('Contacts heard')).toBeInTheDocument();
expect(screen.getByText('Repeaters heard')).toBeInTheDocument();
@@ -427,6 +444,15 @@ describe('SettingsModal', () => {
total_outgoing: 30,
contacts_heard: { last_hour: 2, last_24_hours: 7, last_week: 10 },
repeaters_heard: { last_hour: 1, last_24_hours: 3, last_week: 3 },
path_hash_width_24h: {
total_packets: 120,
single_byte: 60,
double_byte: 36,
triple_byte: 24,
single_byte_pct: 50,
double_byte_pct: 30,
triple_byte_pct: 20,
},
};
const fetchSpy = vi.spyOn(globalThis, 'fetch').mockResolvedValue(