fix: address mobile dashboard review findings
This commit is contained in:
1 parent
c1efaabd36
commit
b4404113c4
11 files changed
+101
-5
No files matched your search
@@ -0,0 +1,15 @@
|
||||
import { describe, expect, test } from "vitest";
|
||||
|
||||
import { formatDiskTemperature } from "./mobile-summary";
|
||||
|
||||
describe("formatDiskTemperature", () => {
|
||||
test("preserves a valid zero-degree reading", () => {
|
||||
expect(formatDiskTemperature(0, true)).toBe("0°C");
|
||||
});
|
||||
|
||||
test("omits unavailable or disabled readings", () => {
|
||||
expect(formatDiskTemperature(null, true)).toBeUndefined();
|
||||
expect(formatDiskTemperature(undefined, true)).toBeUndefined();
|
||||
expect(formatDiskTemperature(20, false)).toBeUndefined();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,2 @@
|
||||
export const formatDiskTemperature = (temperature: number | null | undefined, shouldShow: boolean) =>
|
||||
shouldShow && temperature != null ? `${temperature}°C` : undefined;
|
||||
Reference in new issue
Block a user