Expand test coverage across server, agent, and web; fix bugs found during audit.
Adds hundreds of unit/integration/e2e tests, fixes WS bcrypt auth, config merge, fleet analytics, agent schedule/log tail, and documents stale PROBLEMS items. Updates PROBLEMS.md, README, and test scripts; ignores local spread-kits and coverage dirs.
This commit is contained in:
@@ -17,7 +17,8 @@ export default function GaugeRing({
|
||||
color = 'var(--neon-cyan)',
|
||||
size = 100,
|
||||
}: GaugeRingProps) {
|
||||
const pct = Math.min(100, Math.max(0, (value / max) * 100));
|
||||
const clampedValue = Math.min(max, Math.max(0, value));
|
||||
const pct = max > 0 ? Math.min(100, Math.max(0, (value / max) * 100)) : 0;
|
||||
const circumference = 2 * Math.PI * 42;
|
||||
const offset = circumference - (pct / 100) * circumference;
|
||||
|
||||
@@ -50,7 +51,7 @@ export default function GaugeRing({
|
||||
/>
|
||||
</svg>
|
||||
<div className="gauge-ring-center">
|
||||
<span className="gauge-ring-value font-tech">{formatValue(value, max)}</span>
|
||||
<span className="gauge-ring-value font-tech">{formatValue(clampedValue, max)}</span>
|
||||
<span className="gauge-ring-label">{label}</span>
|
||||
{sublabel && <span className="gauge-ring-sub">{sublabel}</span>}
|
||||
</div>
|
||||
|
||||
@@ -298,11 +298,11 @@ describe('GaugeRing', () => {
|
||||
|
||||
it('shows raw value in center while ring arc clamps to 0–100%', () => {
|
||||
const { rerender, container } = render(<GaugeRing value={-10} max={100} label="X" />);
|
||||
expect(screen.getByText('-10%')).toBeInTheDocument();
|
||||
expect(screen.getByText('0%')).toBeInTheDocument();
|
||||
const fill = container.querySelector('.gauge-ring-fill') as SVGCircleElement;
|
||||
expect(fill.getAttribute('stroke-dashoffset')).toBe(String(2 * Math.PI * 42));
|
||||
rerender(<GaugeRing value={200} max={100} label="X" />);
|
||||
expect(screen.getByText('200%')).toBeInTheDocument();
|
||||
expect(screen.getByText('100%')).toBeInTheDocument();
|
||||
expect((container.querySelector('.gauge-ring-fill') as SVGCircleElement).getAttribute('stroke-dashoffset')).toBe('0');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user