Skip to content

Commit

Permalink
Fix UT
Browse files Browse the repository at this point in the history
  • Loading branch information
fmartinou committed Oct 21, 2024
1 parent 6d1519f commit 83ea2ad
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 19 deletions.
11 changes: 5 additions & 6 deletions app/triggers/providers/mqtt/Hass.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const capitalize = require('capitalize');
const { getVersion } = require('../../../configuration');
const {
registerContainerAdded,
Expand All @@ -10,8 +9,8 @@ const {
const containerStore = require('../../../store/container');

const HASS_DEVICE_ID = 'wud';
const HASS_DEVICE_NAME = 'What\'s up Docker?';
const HASS_MANUFACTURER = 'fmartinou';
const HASS_DEVICE_NAME = 'wud';
const HASS_MANUFACTURER = 'wud';
const HASS_ENTITY_VALUE_TEMPLATE = '{{ value_json.image_tag_value }}';
const HASS_LATEST_VERSION_TEMPLATE = '{% if value_json.update_kind_kind == "digest" %}{{ value_json.result_digest[:15] }}{% else %}{{ value_json.result_tag }}{% endif %}';

Expand All @@ -31,9 +30,9 @@ function getHassEntityId(topic) {
function getHaDevice() {
return {
identifiers: [HASS_DEVICE_ID],
manufacturer: capitalize(HASS_MANUFACTURER),
model: capitalize(HASS_DEVICE_ID),
name: capitalize(HASS_DEVICE_NAME),
manufacturer: HASS_MANUFACTURER,
model: HASS_DEVICE_ID,
name: HASS_DEVICE_NAME,
sw_version: getVersion(),
};
}
Expand Down
26 changes: 13 additions & 13 deletions app/triggers/providers/mqtt/Hass.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ test('publishDiscoveryMessage must publish a discovery message expected by HA',
name: 'My state',
device: {
identifiers: ['wud'],
manufacturer: 'WUD',
model: 'WUD',
name: 'WUD',
manufacturer: 'wud',
model: 'wud',
name: 'wud',
sw_version: 'unknown',
},
icon: 'mdi:docker',
Expand All @@ -63,9 +63,9 @@ test('addContainerSensor must publish sensor discovery message expected by HA',
identifiers: [
'wud',
],
manufacturer: 'WUD',
model: 'WUD',
name: 'WUD',
manufacturer: 'wud',
model: 'wud',
name: 'wud',
sw_version: 'unknown',
},
icon: 'mdi:docker',
Expand Down Expand Up @@ -101,7 +101,7 @@ test('updateContainerSensors must publish all sensors expected by HA', async ()
object_id: 'topic_total_count',
name: 'Total container count',
device: {
identifiers: ['wud'], manufacturer: 'WUD', model: 'WUD', name: 'WUD', sw_version: 'unknown',
identifiers: ['wud'], manufacturer: 'wud', model: 'wud', name: 'wud', sw_version: 'unknown',
},
icon: 'mdi:docker',
entity_picture: 'https://github.com/getwud/wud/raw/main/docs/wud_logo.png',
Expand All @@ -113,7 +113,7 @@ test('updateContainerSensors must publish all sensors expected by HA', async ()
object_id: 'topic_update_count',
name: 'Total container update count',
device: {
identifiers: ['wud'], manufacturer: 'WUD', model: 'WUD', name: 'WUD', sw_version: 'unknown',
identifiers: ['wud'], manufacturer: 'wud', model: 'wud', name: 'wud', sw_version: 'unknown',
},
icon: 'mdi:docker',
entity_picture: 'https://github.com/getwud/wud/raw/main/docs/wud_logo.png',
Expand All @@ -125,7 +125,7 @@ test('updateContainerSensors must publish all sensors expected by HA', async ()
object_id: 'topic_update_status',
name: 'Total container update status',
device: {
identifiers: ['wud'], manufacturer: 'WUD', model: 'WUDWud', name: 'WUD', sw_version: 'unknown',
identifiers: ['wud'], manufacturer: 'wud', model: 'wud', name: 'wud', sw_version: 'unknown',
},
icon: 'mdi:docker',
entity_picture: 'https://github.com/getwud/wud/raw/main/docs/wud_logo.png',
Expand All @@ -139,7 +139,7 @@ test('updateContainerSensors must publish all sensors expected by HA', async ()
object_id: 'topic_watcher-name_total_count',
name: 'Watcher watcher-name container count',
device: {
identifiers: ['wud'], manufacturer: 'WUD', model: 'WUD', name: 'WUD', sw_version: 'unknown',
identifiers: ['wud'], manufacturer: 'wud', model: 'wud', name: 'wud', sw_version: 'unknown',
},
icon: 'mdi:docker',
entity_picture: 'https://github.com/getwud/wud/raw/main/docs/wud_logo.png',
Expand All @@ -151,7 +151,7 @@ test('updateContainerSensors must publish all sensors expected by HA', async ()
object_id: 'topic_watcher-name_update_count',
name: 'Watcher watcher-name container update count',
device: {
identifiers: ['wud'], manufacturer: 'WUD', model: 'WUD', name: 'WUD', sw_version: 'unknown',
identifiers: ['wud'], manufacturer: 'wud', model: 'wud', name: 'wud', sw_version: 'unknown',
},
icon: 'mdi:docker',
entity_picture: 'https://github.com/getwud/wud/raw/main/docs/wud_logo.png',
Expand All @@ -163,7 +163,7 @@ test('updateContainerSensors must publish all sensors expected by HA', async ()
object_id: 'topic_watcher-name_update_status',
name: 'Watcher watcher-name container update status',
device: {
identifiers: ['wud'], manufacturer: 'WUD', model: 'WUD', name: 'WUD', sw_version: 'unknown',
identifiers: ['wud'], manufacturer: 'wud', model: 'wud', name: 'wud', sw_version: 'unknown',
},
icon: 'mdi:docker',
entity_picture: 'https://github.com/getwud/wud/raw/main/docs/wud_logo.png',
Expand Down Expand Up @@ -204,7 +204,7 @@ test('updateWatcherSensors must publish all watcher sensor messages expected by
object_id: 'topic_watcher-name_running',
name: 'Watcher watcher-name running status',
device: {
identifiers: ['wud'], manufacturer: 'WUD', model: 'WUD', name: 'WUD', sw_version: 'unknown',
identifiers: ['wud'], manufacturer: 'wud', model: 'wud', name: 'wud', sw_version: 'unknown',
},
icon: 'mdi:docker',
entity_picture: 'https://github.com/getwud/wud/raw/main/docs/wud_logo.png',
Expand Down

0 comments on commit 83ea2ad

Please sign in to comment.