Add unique and new player metrics (Refs #142)
CI / checks (push) Successful in 4m53s

This commit is contained in:
2026-10-10 18:47:56 -04:00
parent 7fcf1cded2
commit e3e740cea3
16 changed files with 1212 additions and 3 deletions
+8 -1
View File
@@ -6,10 +6,17 @@ import {
metricLobbyAxis,
metricNumber,
metricPercent,
metricPeriodLabels
metricPeriodLabels,
metricPlayerPaths
} from '../../src/lib/ui/metrics.js';
describe('metric presentation', () => {
it('breaks player lines at missing history while retaining real zeroes and isolated points', () => {
const paths = metricPlayerPaths([null, 2, 0, null, 1], 2);
expect(paths.line).toBe('M30,0 L50,100 M90,50');
expect(paths.area).toBe('M30,0 L50,100 L50,100 L30,100 Z M90,50 L90,100 L90,100 Z');
expect(metricPlayerPaths([null, null], 1)).toEqual({ line: '', area: '' });
});
it('normalizes partial buckets by captured wall time and preserves unknown lobby counts', () => {
expect(metricAverageLobbies(14 * 24, 24)).toBe(14);
expect(metricAverageLobbies(14 * 0.5, 0.5)).toBe(14);