mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-06-20 21:43:56 +08:00
- 新增 JVM 持续监控仪表盘、图表、状态卡和详情面板 - 统一概览、资源浏览、审计页面的 JVM 工作台布局 - Sidebar 和 TabManager 支持监控入口、诊断入口兜底和上下文切换 - 补充前端状态模型、展示文案和组件回归测试
42 lines
1.4 KiB
TypeScript
42 lines
1.4 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
|
|
import {
|
|
buildMonitoringAvailabilityText,
|
|
formatMonitoringAxisBytes,
|
|
formatRecentGCLabel,
|
|
normalizeMonitoringProviderMode,
|
|
} from "./jvmMonitoringPresentation";
|
|
|
|
describe("jvmMonitoringPresentation", () => {
|
|
it("summarizes degraded metrics with missing items and warnings", () => {
|
|
expect(
|
|
buildMonitoringAvailabilityText({
|
|
missingMetrics: ["cpu.process", "memory.rss"],
|
|
providerWarnings: ["endpoint cpu metric unavailable"],
|
|
}),
|
|
).toContain("缺失指标");
|
|
});
|
|
|
|
it("formats recent gc event label with duration", () => {
|
|
expect(
|
|
formatRecentGCLabel({
|
|
timestamp: 1713945600000,
|
|
name: "G1 Young Generation",
|
|
durationMs: 21,
|
|
}),
|
|
).toContain("21ms");
|
|
});
|
|
|
|
it("formats byte axis ticks with compact units instead of raw byte numbers", () => {
|
|
expect(formatMonitoringAxisBytes(120_000_000)).toBe("114 MB");
|
|
expect(formatMonitoringAxisBytes(0)).toBe("0 B");
|
|
expect(formatMonitoringAxisBytes(undefined)).toBe("--");
|
|
});
|
|
|
|
it("normalizes provider mode and falls back on unknown values", () => {
|
|
expect(normalizeMonitoringProviderMode("AGENT", "jmx")).toBe("agent");
|
|
expect(normalizeMonitoringProviderMode("unsupported", "endpoint")).toBe("endpoint");
|
|
expect(normalizeMonitoringProviderMode(undefined, "jmx")).toBe("jmx");
|
|
});
|
|
});
|