mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-16 20:11:08 +00:00
* feat(monitor): 优化磁盘IO展示与系统分区告警 [4030] * fix(monitor): 修复磁盘监控评审问题 [4030] * fix(monitor): align Partitions bars with Memory; hide bare / label Label-above-bar for partition list; single-root `/` hides the label and centers the bar like Memory/CPU (unchanged). Multi-disk keeps top align + system alerts. Disk IO adds a spacer row to track usage labels. Review crops under .github/review/ for PR discussion (drop before merge OK). * fix(monitor): keep bare-/ align; multi-disk labels stay left Address Chris density feedback: keep the single root label hidden and vertically centered with Memory, and restore side-by-side labels for multiple disks. Remove the Disk I/O spacer and update the review crops. * chore(monitor): drop PR #4031 discussion review crops --------- Co-authored-by: wendeng.dong <wendeng.dong@sailuntire.com> Co-authored-by: 陈大猫 <16399091+binaricat@users.noreply.github.com>
15 lines
592 B
TypeScript
15 lines
592 B
TypeScript
import test from "node:test";
|
|
import assert from "node:assert/strict";
|
|
import { formatMonitorRate } from "./monitorFormatting";
|
|
|
|
test("disk and network rates adapt to decimal KB/MB/GB units", () => {
|
|
for (const [value, expected] of [
|
|
[0, "0.0 KB/s"], [500, "0.5 KB/s"], [1000, "1.0 KB/s"],
|
|
[999000, "999.0 KB/s"], [1e6, "1.0 MB/s"], [2.5e6, "2.5 MB/s"],
|
|
[1e9, "1.0 GB/s"], [12e9, "12.0 GB/s"],
|
|
] as const) assert.equal(formatMonitorRate(value), expected);
|
|
for (const value of [null, undefined, NaN, Infinity, -1]) {
|
|
assert.equal(formatMonitorRate(value), "--");
|
|
}
|
|
});
|