Improve engine identification and id generation.

This commit is contained in:
Dermot Duffy
2023-10-08 14:53:05 -07:00
parent fb5fbe4ce1
commit 7a33f75889
12 changed files with 222 additions and 142 deletions
@@ -192,11 +192,23 @@ describe('GenericCameraManagerEngine', () => {
expect(
createEngine().getCameraMetadata(createHASS(), createGenericCameraConfig()),
).toEqual({
icon: 'mdi:bookmark',
icon: 'mdi:video',
title: '',
});
});
it('with id', async () => {
expect(
createEngine().getCameraMetadata(
createHASS(),
createGenericCameraConfig({ id: 'https://go2rtc#stream' }),
),
).toEqual({
icon: 'mdi:video',
title: 'https://go2rtc#stream',
});
});
it('with configured title', async () => {
expect(
createEngine().getCameraMetadata(
@@ -206,7 +218,7 @@ describe('GenericCameraManagerEngine', () => {
}),
),
).toEqual({
icon: 'mdi:bookmark',
icon: 'mdi:video',
title: 'My Camera',
});
});
@@ -225,7 +237,7 @@ describe('GenericCameraManagerEngine', () => {
}),
),
).toEqual({
icon: 'mdi:bookmark',
icon: 'mdi:video',
title: 'My Entity Camera',
});
});
@@ -245,7 +257,7 @@ describe('GenericCameraManagerEngine', () => {
}),
),
).toEqual({
icon: 'mdi:bookmark',
icon: 'mdi:video',
title: 'My Entity Camera',
});
});