Fix OTA percentage. #3422

This commit is contained in:
Koen Kanters
2020-04-24 22:38:51 +02:00
parent 265d5c4877
commit 48641f3028
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -170,7 +170,7 @@ class OTAUpdate extends Extension {
try {
const onProgress = (progress, remaining) => {
let message = `Update of '${resolvedEntity.name}' at ${progress}%`;
let message = `Update of '${resolvedEntity.name}' at ${progress.toFixed(2)}%`;
if (remaining) {
message += `, +- ${Math.round(remaining / 60)} minutes remaining`;
}
+2 -2
View File
@@ -54,8 +54,8 @@ describe('OTA update', () => {
expect(mapped.ota.isUpdateAvailable).toHaveBeenCalledTimes(0);
expect(mapped.ota.updateToLatest).toHaveBeenCalledTimes(1);
expect(mapped.ota.updateToLatest).toHaveBeenCalledWith(device, logger, expect.any(Function));
expect(logger.info).toHaveBeenCalledWith(`Update of 'bulb' at 0%`);
expect(logger.info).toHaveBeenCalledWith(`Update of 'bulb' at 10%, +- 60 minutes remaining`);
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', from '{"softwareBuildID":1,"dateCode":"20190101"}' to '{"softwareBuildID":2,"dateCode":"20190102"}'`);
expect(logger.error).toHaveBeenCalledTimes(0);
expect(device.save).toHaveBeenCalledTimes(1);