fix tests
This commit is contained in:
@@ -21,7 +21,7 @@ function setUpdateInfo(state) {
|
||||
// appid -> update info { creationDate, manifest }
|
||||
// box -> { version, changelog, upgrade, sourceTarballUrl }
|
||||
state.version = 2;
|
||||
safe.fs.writeFileSync(paths.UPDATE_CHECKER_FILE, JSON.stringify(state, null, 4), 'utf8');
|
||||
if (!safe.fs.writeFileSync(paths.UPDATE_CHECKER_FILE, JSON.stringify(state, null, 4), 'utf8')) debug(`setUpdateInfo: Error writing to update checker file: ${safe.error.message}`);
|
||||
}
|
||||
|
||||
function getUpdateInfo() {
|
||||
@@ -74,7 +74,7 @@ function checkBoxUpdates(options, callback) {
|
||||
|
||||
debug('checkBoxUpdates: checking for updates');
|
||||
|
||||
appstore.getBoxUpdate(options, function (error, updateInfo) {
|
||||
appstore.getBoxUpdate(options, async function (error, updateInfo) {
|
||||
if (error) return callback(error);
|
||||
|
||||
let state = getUpdateInfo();
|
||||
@@ -90,7 +90,7 @@ function checkBoxUpdates(options, callback) {
|
||||
|
||||
if (state.box && state.box.version === updateInfo.version) {
|
||||
debug(`checkBoxUpdates: Skipping notification of box update ${updateInfo.version} as user was already notified`);
|
||||
return callback();
|
||||
return callback(null);
|
||||
}
|
||||
|
||||
debug(`checkBoxUpdates: ${updateInfo.version} is available`);
|
||||
@@ -99,14 +99,13 @@ function checkBoxUpdates(options, callback) {
|
||||
|
||||
const message = `Changelog:\n${changelog}\n\nGo to the settings view to update.\n\n`;
|
||||
|
||||
notifications.alert(notifications.ALERT_BOX_UPDATE, `Cloudron v${updateInfo.version} is available`, message, function (error) {
|
||||
if (error) return callback(error);
|
||||
[error] = await safe(notifications.alert(notifications.ALERT_BOX_UPDATE, `Cloudron v${updateInfo.version} is available`, message));
|
||||
if (error) return callback(error);
|
||||
|
||||
state.box = updateInfo;
|
||||
setUpdateInfo(state);
|
||||
state.box = updateInfo;
|
||||
setUpdateInfo(state);
|
||||
|
||||
callback();
|
||||
});
|
||||
callback(null);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user