From 13443a42ce7239a7308efb829c8ff007e59ca45d Mon Sep 17 00:00:00 2001 From: Rotzbua Date: Sun, 5 Nov 2023 21:01:55 +0100 Subject: [PATCH] fix(typo): correct misspell (#19581) Credit to `codespell`. --- lib/extension/legacy/bridgeLegacy.ts | 2 +- lib/extension/legacy/softReset.ts | 2 +- scripts/install.sh | 2 +- test/bridge.test.js | 4 ++-- test/homeassistant.test.js | 8 ++++---- test/networkMap.test.js | 2 +- test/otaUpdate.test.js | 10 +++++----- test/publish.test.js | 2 +- test/receive.test.js | 8 ++++---- 9 files changed, 20 insertions(+), 20 deletions(-) diff --git a/lib/extension/legacy/bridgeLegacy.ts b/lib/extension/legacy/bridgeLegacy.ts index a937c49cb..2eaf6cf62 100644 --- a/lib/extension/legacy/bridgeLegacy.ts +++ b/lib/extension/legacy/bridgeLegacy.ts @@ -90,7 +90,7 @@ export default class BridgeLegacy extends Extension { @bind async reset(): Promise { try { await this.zigbee.reset('soft'); - logger.info('Soft resetted ZNP'); + logger.info('Soft reset ZNP'); } catch (error) { logger.error('Soft reset failed'); } diff --git a/lib/extension/legacy/softReset.ts b/lib/extension/legacy/softReset.ts index 5aeb8eee8..522b05c5f 100644 --- a/lib/extension/legacy/softReset.ts +++ b/lib/extension/legacy/softReset.ts @@ -43,7 +43,7 @@ export default class SoftReset extends Extension { try { await this.zigbee.reset('soft'); - logger.warn('Soft resetted ZNP due to timeout'); + logger.warn('Soft reset ZNP due to timeout'); } catch (error) { logger.warn('Soft reset failed, trying stop/start'); diff --git a/scripts/install.sh b/scripts/install.sh index f6c1a8a18..00f8b76d9 100644 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -24,7 +24,7 @@ echo "Cloning Zigbee2MQTT git repository" git clone https://github.com/Koenkk/zigbee2mqtt.git /opt/zigbee2mqtt chown -R pi:pi /opt/zigbee2mqtt -echo "Running install. This might take a while and can produce som expected errors" +echo "Running install. This might take a while and can produce some expected errors" cd /opt/zigbee2mqtt || exit su pi -c "npm ci" diff --git a/test/bridge.test.js b/test/bridge.test.js index 8493f47cc..f58ac95e2 100644 --- a/test/bridge.test.js +++ b/test/bridge.test.js @@ -796,7 +796,7 @@ describe('Bridge', () => { }); it('Should allow to enable/disable Home Assistant extension', async () => { - // Test if disabled intially + // Test if disabled initially const device = zigbeeHerdsman.devices.WXKG11LM; settings.set(['devices', device.ieeeAddr, 'legacy'], false); const payload = {data: {onOff: 1}, cluster: 'genOnOff', device, endpoint: device.getEndpoint(1), type: 'attributeReport', linkquality: 10}; @@ -1077,7 +1077,7 @@ describe('Bridge', () => { ); }); - it('Should throw error when configure reporting is called with misformed payload', async () => { + it('Should throw error when configure reporting is called with malformed payload', async () => { const device = zigbeeHerdsman.devices.bulb; const endpoint = device.getEndpoint(1); endpoint.configureReporting.mockClear(); diff --git a/test/homeassistant.test.js b/test/homeassistant.test.js index 8b3e266f6..c07133e64 100644 --- a/test/homeassistant.test.js +++ b/test/homeassistant.test.js @@ -495,7 +495,7 @@ describe('HomeAssistant extension', () => { ); }); - it('Should discover devices with overriden user configuration', async () => { + it('Should discover devices with overridden user configuration', async () => { settings.set(['devices', '0x0017880104e45522'], { homeassistant: { expire_after: 30, @@ -584,7 +584,7 @@ describe('HomeAssistant extension', () => { ); }); - it('Should discover devices with overriden name', async () => { + it('Should discover devices with overridden name', async () => { settings.set(['devices', '0x0017880104e45522'], { homeassistant: { name: "Weather Sensor", @@ -655,7 +655,7 @@ describe('HomeAssistant extension', () => { ); }); - it('Should discover devices with overriden user configuration affecting type and object_id', async () => { + it('Should discover devices with overridden user configuration affecting type and object_id', async () => { settings.set(['devices', '0x0017880104e45541'], { friendly_name: 'my_switch', homeassistant: { @@ -1609,7 +1609,7 @@ describe('HomeAssistant extension', () => { await flushPromises(); expect(MQTT.publish).not.toHaveBeenCalledWith('homeassistant/device_automation/0x0017880104e45520/action_double/config', expect.any(String), expect.any(Object), expect.any(Function)); - // Should rediscover when already discovered in previous session but with diferent name + // Should rediscover when already discovered in previous session but with different name controller.extensions.find((e) => e.constructor.name === 'HomeAssistant')._clearDiscoveredTrigger(); await MQTT.events.message('homeassistant/device_automation/0x0017880104e45520/action_double/config', stringify({topic: 'zigbee2mqtt/button_other_name/action'})); await flushPromises(); diff --git a/test/networkMap.test.js b/test/networkMap.test.js index 60c806b59..dbbc77272 100644 --- a/test/networkMap.test.js +++ b/test/networkMap.test.js @@ -281,7 +281,7 @@ describe('Networkmap', () => { expect(actual).toStrictEqual(expected); }); - it('Should throw error when rquesting invalid type', async () => { + it('Should throw error when requesting invalid type', async () => { mock(); MQTT.publish.mockClear(); MQTT.events.message('zigbee2mqtt/bridge/request/networkmap', 'not_existing'); diff --git a/test/otaUpdate.test.js b/test/otaUpdate.test.js index 1f671b173..ee1f55113 100644 --- a/test/otaUpdate.test.js +++ b/test/otaUpdate.test.js @@ -174,7 +174,7 @@ describe('OTA update', () => { const device = zigbeeHerdsman.devices.bulb; const mapped = zigbeeHerdsmanConverters.findByDevice(device) mockClear(mapped); - mapped.ota.isUpdateAvailable.mockImplementationOnce(() => {throw new Error('RF singals disturbed because of dogs barking')}); + mapped.ota.isUpdateAvailable.mockImplementationOnce(() => {throw new Error('RF signals disturbed because of dogs barking')}); MQTT.events.message('zigbee2mqtt/bridge/request/device/ota_update/check', "bulb"); await flushPromises(); @@ -182,7 +182,7 @@ describe('OTA update', () => { expect(mapped.ota.updateToLatest).toHaveBeenCalledTimes(0); expect(MQTT.publish).toHaveBeenCalledWith( 'zigbee2mqtt/bridge/response/device/ota_update/check', - stringify({"data":{"id": "bulb"},"status":"error","error": `Failed to check if update available for 'bulb' (RF singals disturbed because of dogs barking)`}), + stringify({"data":{"id": "bulb"},"status":"error","error": `Failed to check if update available for 'bulb' (RF signals disturbed because of dogs barking)`}), {retain: false, qos: 0}, expect.any(Function) ); }); @@ -386,7 +386,7 @@ describe('OTA update', () => { expect(logger.info).toHaveBeenCalledWith(`Update of 'bulb' at 0.00%`); expect(logger.info).toHaveBeenCalledWith(`Update of 'bulb' at 10.00%, ≈ 60 minutes remaining`); expect(logger.info).toHaveBeenCalledWith(`Finished update of 'bulb'`); - expect(logger.info).toHaveBeenCalledWith(`Device 'bulb' was updated from '{"dateCode":"20190101","softwareBuildID":1}' to '{"dateCode":"20190103","softwareBuildID":3}'`); + expect(logger.info).toHaveBeenCalledWith(`Device 'bulb' was updated from '{"dateCode":"20190101","softwareBuildID":1}' to '{"dateCode":"20190103","softwareBuildID":3}'`); expect(logger.error).toHaveBeenCalledTimes(0); expect(device.save).toHaveBeenCalledTimes(2); expect(endpoint.read).toHaveBeenCalledWith('genBasic', ['dateCode', 'swBuildId'], {'sendWhen': 'immediate'}); @@ -438,13 +438,13 @@ describe('OTA update', () => { const mapped = zigbeeHerdsmanConverters.findByDevice(device) mockClear(mapped); logger.error.mockClear(); - mapped.ota.isUpdateAvailable.mockImplementationOnce(() => {throw new Error('RF singals disturbed because of dogs barking')}); + mapped.ota.isUpdateAvailable.mockImplementationOnce(() => {throw new Error('RF signals disturbed because of dogs barking')}); MQTT.events.message('zigbee2mqtt/bridge/ota_update/check', 'bulb'); await flushPromises(); expect(mapped.ota.isUpdateAvailable).toHaveBeenCalledTimes(1); expect(mapped.ota.updateToLatest).toHaveBeenCalledTimes(0); - expect(logger.error).toHaveBeenCalledWith(`Failed to check if update available for 'bulb' (RF singals disturbed because of dogs barking)`); + expect(logger.error).toHaveBeenCalledWith(`Failed to check if update available for 'bulb' (RF signals disturbed because of dogs barking)`); }); it('Legacy api: Should not check for OTA when device does not support it', async () => { diff --git a/test/publish.test.js b/test/publish.test.js index 79e7cb1e2..a6287d6df 100644 --- a/test/publish.test.js +++ b/test/publish.test.js @@ -1276,7 +1276,7 @@ describe('Publish', () => { expect(endpoint.command).toHaveBeenCalledWith("ssIasWd", "startWarning", {"startwarninginfo": 53, "warningduration": 10, "strobedutycycle": 0, "strobelevel": 1}, {disableDefaultResponse: true}); }); - it('Shouldnt do anythign when device is not supported', async () => { + it('Shouldnt do anything when device is not supported', async () => { const payload = {state: 'ON'}; await MQTT.events.message('zigbee2mqtt/unsupported2/set', stringify(payload)); await flushPromises(); diff --git a/test/receive.test.js b/test/receive.test.js index 59bac63a6..8190ab36e 100755 --- a/test/receive.test.js +++ b/test/receive.test.js @@ -182,7 +182,7 @@ describe('Receive', () => { // Summary: // First send multiple measurements to device that is debouncing. Make sure only one message is sent out to MQTT. This also ensures first message is cached to "State". - // Then send another measurement to that same device and trigger asyncronous event to push data from Cache. Newest value should be sent out. + // Then send another measurement to that same device and trigger asynchronous event to push data from Cache. Newest value should be sent out. const device = zigbeeHerdsman.devices.WSDCGQ11LM; settings.set(['devices', device.ieeeAddr, 'debounce'], 0.1); @@ -201,11 +201,11 @@ describe('Receive', () => { expect(MQTT.publish.mock.calls[0][0]).toStrictEqual('zigbee2mqtt/weather_sensor'); expect(JSON.parse(MQTT.publish.mock.calls[0][1])).toStrictEqual({temperature: 0.08, humidity: 0.01, pressure: 2}); - // Send another Zigbee messages... + // Send another Zigbee message... await zigbeeHerdsman.events.message({data: {measuredValue: 9}, cluster: 'msTemperatureMeasurement', device, endpoint: device.getEndpoint(1), type: 'attributeReport', linkquality: 10}); const realDevice = controller.zigbee.resolveEntity(device); - // Trigger asyncronous event while device is "debouncing" to trigger Message to be sent out from State cache. + // Trigger asynchronous event while device is "debouncing" to trigger Message to be sent out from State cache. await controller.publishEntityState( realDevice, {} ); jest.runOnlyPendingTimers(); await flushPromises(); @@ -213,7 +213,7 @@ describe('Receive', () => { // Total of 3 messages should have triggered. expect(MQTT.publish).toHaveBeenCalledTimes(3); - // Test that message pushed by asyncronous message contains NEW measurement and not old. + // Test that message pushed by asynchronous message contains NEW measurement and not old. expect(JSON.parse(MQTT.publish.mock.calls[1][1])).toStrictEqual({temperature: 0.09, humidity: 0.01, pressure: 2}); // Test that messages after debouncing contains NEW measurement and not old. expect(JSON.parse(MQTT.publish.mock.calls[2][1])).toStrictEqual({temperature: 0.09, humidity: 0.01, pressure: 2});