Preserve shortage signals during global pause (Refs #137)
CI / checks (push) Successful in 4m47s

This commit is contained in:
2026-10-10 16:11:24 -04:00
parent 33da4482a6
commit ea932ec563
14 changed files with 154 additions and 26 deletions
+19
View File
@@ -3,6 +3,7 @@ import {
compareMetricValues,
metricAverageLobbies,
metricDuration,
metricLobbyAxis,
metricNumber,
metricPercent,
metricPeriodLabels
@@ -17,6 +18,24 @@ describe('metric presentation', () => {
expect(metricAverageLobbies(0, 0)).toBeNull();
expect(metricAverageLobbies(4, Number.NaN)).toBeNull();
});
it.each<[number, number[]]>([
[0, [1, 0]],
[0.4, [1, 0]],
[1, [1, 0]],
[2.1, [3, 2, 1, 0]],
[3.75, [4, 3, 2, 1, 0]],
[5, [6, 4, 2, 0]],
[14, [15, 10, 5, 0]],
[41.2, [60, 40, 20, 0]],
[999, [1000, 500, 0]],
[2500, [3000, 2000, 1000, 0]]
])('uses whole-lobby ticks that cover an average of %s', (maximum, expected) => {
const axis = metricLobbyAxis(maximum);
expect(axis.ticks).toEqual(expected);
expect(axis.ceiling).toBe(axis.ticks[0]);
expect(axis.ceiling).toBeGreaterThanOrEqual(maximum);
expect(axis.ticks.every(Number.isInteger)).toBe(true);
});
it('distinguishes unavailable evidence, zero, and tiny nonzero values', () => {
expect(metricPercent(0, 0)).toBe('—');
expect(metricPercent(0, 1)).toBe('0.0%');