mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-07-16 21:33:41 +00:00
9c8528e4d2
file-manager/, metrics/ (incl. widgets, managers, alert-engine), terminal/, tmux/ and tunnel/ each own their files; docker/ gains container-runtime. Genuinely shared helpers (jump-host chain, host resolver, connection pool, opkssh, vault, serial) stay at hosts/ root. Pure file moves with import path updates; mirrored test paths follow.
34 lines
883 B
TypeScript
34 lines
883 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
import {
|
|
parseSensorsOutput,
|
|
parseSysfsThermalOutput,
|
|
} from "../../../../hosts/metrics/widgets/temperature-collector.js";
|
|
|
|
describe("temperature collectors", () => {
|
|
it("parses sysfs thermal zone output", () => {
|
|
const result = parseSysfsThermalOutput(
|
|
"x86_pkg_temp\t51000\nacpitz\t42\nbad\tnope\n",
|
|
);
|
|
|
|
expect(result).toEqual([
|
|
{ label: "x86_pkg_temp", celsius: 51 },
|
|
{ label: "acpitz", celsius: 42 },
|
|
]);
|
|
});
|
|
|
|
it("parses lm-sensors temperature lines", () => {
|
|
const result = parseSensorsOutput(`
|
|
coretemp-isa-0000
|
|
Adapter: ISA adapter
|
|
Package id 0: +52.0°C (high = +80.0°C, crit = +100.0°C)
|
|
Core 0: +48.5°C
|
|
fan1: 1200 RPM
|
|
`);
|
|
|
|
expect(result).toEqual([
|
|
{ label: "Package id 0", celsius: 52 },
|
|
{ label: "Core 0", celsius: 48.5 },
|
|
]);
|
|
});
|
|
});
|