feat: modernize dashboard widgets
This commit is contained in:
1 parent
1a5e083fd0
commit
6f2cd7fc2b
270 files changed
+10189
-3544
No files matched your search
@@ -0,0 +1,24 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { toSafeEntityDetails } from "./smart-home-entity-state";
|
||||
|
||||
describe("toSafeEntityDetails", () => {
|
||||
it("keeps display attributes and removes sensitive Home Assistant metadata", () => {
|
||||
const details = toSafeEntityDetails({
|
||||
entity_id: "camera.front_door",
|
||||
state: "streaming",
|
||||
last_changed: new Date("2026-01-01T00:00:00Z"),
|
||||
last_updated: new Date("2026-01-01T00:00:01Z"),
|
||||
attributes: {
|
||||
friendly_name: "Front door",
|
||||
icon: "mdi:camera",
|
||||
access_token: "secret-camera-token",
|
||||
latitude: 48.85,
|
||||
},
|
||||
});
|
||||
|
||||
expect(details.attributes).toEqual({ friendly_name: "Front door", icon: "mdi:camera" });
|
||||
expect(details.attributes).not.toHaveProperty("access_token");
|
||||
expect(details.attributes).not.toHaveProperty("latitude");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user