1
0
mirror of https://github.com/home-assistant/frontend.git synced 2026-04-28 12:44:25 +01:00

Add formatEntityName helper on hass object. (#26057)

This commit is contained in:
Paul Bottein
2025-09-15 16:18:52 +02:00
committed by GitHub
parent 9d02a1d391
commit af31b5add3
23 changed files with 285 additions and 149 deletions

View File

@@ -1,7 +1,10 @@
import type { HassEntity } from "home-assistant-js-websocket";
import type { EntityRegistryDisplayEntry } from "../../../../src/data/entity_registry";
import type { DeviceRegistryEntry } from "../../../../src/data/device_registry";
import type { AreaRegistryEntry } from "../../../../src/data/area_registry";
import type { DeviceRegistryEntry } from "../../../../src/data/device_registry";
import type {
EntityRegistryDisplayEntry,
EntityRegistryEntry,
} from "../../../../src/data/entity_registry";
import type { FloorRegistryEntry } from "../../../../src/data/floor_registry";
export const mockStateObj = (partial: Partial<HassEntity>): HassEntity => ({
@@ -26,6 +29,31 @@ export const mockEntity = (
...partial,
});
export const mockEntityEntry = (
partial: Partial<EntityRegistryEntry>
): EntityRegistryEntry => ({
entity_id: "",
name: null,
icon: null,
platform: "",
config_entry_id: null,
config_subentry_id: null,
device_id: null,
area_id: null,
labels: [],
disabled_by: null,
hidden_by: null,
entity_category: null,
has_entity_name: false,
unique_id: "",
id: "",
options: null,
categories: {},
created_at: 0,
modified_at: 0,
...partial,
});
export const mockDevice = (
partial: Partial<DeviceRegistryEntry>
): DeviceRegistryEntry => ({