appstore: automatic is not stableOnly
This commit is contained in:
+2
-2
@@ -139,7 +139,7 @@ async function getBoxUpdate(options) {
|
||||
const query = {
|
||||
accessToken: token,
|
||||
boxVersion: constants.VERSION,
|
||||
automatic: options.automatic
|
||||
stableOnly: options.stableOnly
|
||||
};
|
||||
|
||||
const [error, response] = await safe(superagent.get(`${await getApiServerOrigin()}/api/v1/boxupdate`)
|
||||
@@ -182,7 +182,7 @@ async function getAppUpdate(app, options) {
|
||||
boxVersion: constants.VERSION,
|
||||
appId: app.appStoreId,
|
||||
appVersion: app.manifest.version,
|
||||
automatic: options.automatic
|
||||
stableOnly: options.stableOnly
|
||||
};
|
||||
|
||||
const [error, response] = await safe(superagent.get(`${await getApiServerOrigin()}/api/v1/appupdate`)
|
||||
|
||||
+1
-1
@@ -130,7 +130,7 @@ async function startJobs() {
|
||||
// this is run separately from the update itself so that the user can disable automatic updates but can still get a notification
|
||||
gJobs.updateCheckerJob = CronJob.from({
|
||||
cronTime: `00 ${minute} 1,5,9,13,17,21,23 * * *`,
|
||||
onTick: async () => await safe(updateChecker.checkForUpdates({ automatic: true }), { debug }),
|
||||
onTick: async () => await safe(updateChecker.checkForUpdates({ stableOnly: true }), { debug }),
|
||||
start: true
|
||||
});
|
||||
|
||||
|
||||
+1
-1
@@ -1049,7 +1049,7 @@ async function checkForUpdates(req, res, next) {
|
||||
// it can take a while sometimes to get all the app updates one by one
|
||||
req.clearTimeout();
|
||||
|
||||
await updateChecker.checkForUpdates({ automatic: false }); // appId argument is ignored for the moment
|
||||
await updateChecker.checkForUpdates({ stableOnly: false }); // appId argument is ignored for the moment
|
||||
next(new HttpSuccess(200, { update: updateChecker.getUpdateInfo() }));
|
||||
}
|
||||
|
||||
|
||||
@@ -56,6 +56,6 @@ async function checkForUpdates(req, res, next) {
|
||||
// it can take a while sometimes to get all the app updates one by one
|
||||
req.clearTimeout();
|
||||
|
||||
await updateChecker.checkForUpdates({ automatic: false });
|
||||
await updateChecker.checkForUpdates({ stableOnly: false });
|
||||
next(new HttpSuccess(200, { update: updateChecker.getUpdateInfo() }));
|
||||
}
|
||||
|
||||
@@ -36,10 +36,10 @@ describe('updatechecker', function () {
|
||||
|
||||
const scope = nock(mockApiServerOrigin)
|
||||
.get('/api/v1/boxupdate')
|
||||
.query({ boxVersion: constants.VERSION, accessToken: appstoreToken, automatic: false })
|
||||
.query({ boxVersion: constants.VERSION, accessToken: appstoreToken, stableOnly: false })
|
||||
.reply(204, { } );
|
||||
|
||||
await updatechecker.checkForUpdates({ automatic: false });
|
||||
await updatechecker.checkForUpdates({ stableOnly: false });
|
||||
expect(updatechecker.getUpdateInfo().box).to.not.be.ok();
|
||||
expect(scope.isDone()).to.be.ok();
|
||||
});
|
||||
@@ -49,10 +49,10 @@ describe('updatechecker', function () {
|
||||
|
||||
const scope = nock(mockApiServerOrigin)
|
||||
.get('/api/v1/boxupdate')
|
||||
.query({ boxVersion: constants.VERSION, accessToken: appstoreToken, automatic: false })
|
||||
.query({ boxVersion: constants.VERSION, accessToken: appstoreToken, stableOnly: false })
|
||||
.reply(200, { version: UPDATE_VERSION, changelog: [''], sourceTarballUrl: 'box.tar.gz', sourceTarballSigUrl: 'box.tar.gz.sig', boxVersionsUrl: 'box.versions', boxVersionsSigUrl: 'box.versions.sig', unstable: false } );
|
||||
|
||||
await updatechecker.checkForUpdates({ automatic: false });
|
||||
await updatechecker.checkForUpdates({ stableOnly: false });
|
||||
expect(updatechecker.getUpdateInfo().box).to.be.ok();
|
||||
expect(updatechecker.getUpdateInfo().box.version).to.be(UPDATE_VERSION);
|
||||
expect(updatechecker.getUpdateInfo().box.sourceTarballUrl).to.be('box.tar.gz');
|
||||
@@ -64,10 +64,10 @@ describe('updatechecker', function () {
|
||||
|
||||
const scope = nock(mockApiServerOrigin)
|
||||
.get('/api/v1/boxupdate')
|
||||
.query({ boxVersion: constants.VERSION, accessToken: appstoreToken, automatic: false })
|
||||
.query({ boxVersion: constants.VERSION, accessToken: appstoreToken, stableOnly: false })
|
||||
.reply(404, { version: '2.0.0-pre.0', changelog: [''], sourceTarballUrl: 'box-pre.tar.gz' } );
|
||||
|
||||
await updatechecker.checkForUpdates({ automatic: false });
|
||||
await updatechecker.checkForUpdates({ stableOnly: false });
|
||||
expect(updatechecker.getUpdateInfo().box.version).to.be(UPDATE_VERSION);
|
||||
expect(updatechecker.getUpdateInfo().box.sourceTarballUrl).to.be('box.tar.gz');
|
||||
expect(scope.isDone()).to.be.ok();
|
||||
@@ -86,10 +86,10 @@ describe('updatechecker', function () {
|
||||
|
||||
const scope = nock(mockApiServerOrigin)
|
||||
.get('/api/v1/appupdate')
|
||||
.query({ boxVersion: constants.VERSION, accessToken: appstoreToken, appId: app.appStoreId, appVersion: app.manifest.version, automatic: false })
|
||||
.query({ boxVersion: constants.VERSION, accessToken: appstoreToken, appId: app.appStoreId, appVersion: app.manifest.version, stableOnly: false })
|
||||
.reply(204, { } );
|
||||
|
||||
await updatechecker._checkAppUpdates({ automatic: false });
|
||||
await updatechecker._checkAppUpdates({ stableOnly: false });
|
||||
expect(updatechecker.getUpdateInfo()).to.eql({});
|
||||
expect(scope.isDone()).to.be.ok();
|
||||
});
|
||||
@@ -99,10 +99,10 @@ describe('updatechecker', function () {
|
||||
|
||||
const scope = nock(mockApiServerOrigin)
|
||||
.get('/api/v1/appupdate')
|
||||
.query({ boxVersion: constants.VERSION, accessToken: appstoreToken, appId: app.appStoreId, appVersion: app.manifest.version, automatic: false })
|
||||
.query({ boxVersion: constants.VERSION, accessToken: appstoreToken, appId: app.appStoreId, appVersion: app.manifest.version, stableOnly: false })
|
||||
.reply(500, { update: { manifest: { version: '1.0.0', changelog: '* some changes' } } } );
|
||||
|
||||
await updatechecker._checkAppUpdates({ automatic: false });
|
||||
await updatechecker._checkAppUpdates({ stableOnly: false });
|
||||
expect(updatechecker.getUpdateInfo()).to.eql({});
|
||||
expect(scope.isDone()).to.be.ok();
|
||||
});
|
||||
@@ -112,10 +112,10 @@ describe('updatechecker', function () {
|
||||
|
||||
const scope = nock(mockApiServerOrigin)
|
||||
.get('/api/v1/appupdate')
|
||||
.query({ boxVersion: constants.VERSION, accessToken: appstoreToken, appId: app.appStoreId, appVersion: app.manifest.version, automatic: false })
|
||||
.query({ boxVersion: constants.VERSION, accessToken: appstoreToken, appId: app.appStoreId, appVersion: app.manifest.version, stableOnly: false })
|
||||
.reply(200, { manifest: { version: '2.0.0', changelog: '* some changes' } } );
|
||||
|
||||
await updatechecker._checkAppUpdates({ automatic: false });
|
||||
await updatechecker._checkAppUpdates({ stableOnly: false });
|
||||
expect(updatechecker.getUpdateInfo()).to.eql({ 'appid': { manifest: { version: '2.0.0', changelog: '* some changes' }, unstable: false } });
|
||||
expect(scope.isDone()).to.be.ok();
|
||||
});
|
||||
@@ -123,7 +123,7 @@ describe('updatechecker', function () {
|
||||
it('does not offer old version', async function () {
|
||||
nock.cleanAll();
|
||||
|
||||
await updatechecker._checkAppUpdates({ automatic: false });
|
||||
await updatechecker._checkAppUpdates({ stableOnly: false });
|
||||
expect(updatechecker.getUpdateInfo()).to.eql({ });
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user