test updater

This commit is contained in:
Jiiks 2019-03-05 23:46:42 +02:00
parent 76057efbb7
commit 9ef392c575
2 changed files with 19 additions and 3 deletions

View File

@ -8,10 +8,26 @@
* LICENSE file in the root directory of this source tree.
*/
export default new class {
import Events from './events';
import Module from './imodule';
export default new class extends Module {
get updates() { return this.state.updates }
get bdUpdates() { return this.state.updates.bd }
constructor() {
super({
updatesAvailable: false,
error: null,
updates: { bd: [] }
});
}
events(ipc) {
ipc.on('updater-checkForUpdates', () => {
Events.emit('update-check-start');
});
}
}

View File

@ -39,6 +39,7 @@ const TEST_ARGS = () => {
}
}
const TEST_EDITOR = TESTS && true;
const TEST_UPDATER = TESTS && true;
import path from 'path';
import sass from 'node-sass';
@ -237,8 +238,6 @@ export class BetterDiscord {
await this.waitForWindowUtils();
await this.ensureDirectories();
await this.updater.checkForUpdates();
this.windowUtils.on('did-finish-load', () => this.injectScripts(true));
this.windowUtils.on('did-navigate-in-page', (event, url, isMainFrame) => {
@ -342,6 +341,7 @@ export class BetterDiscord {
*/
async injectScripts(reload = false) {
console.log(`[BetterDiscord] injecting ${this.config.getPath('client_script')}. Reload: ${reload}`);
if (TEST_UPDATER) setTimeout(this.updater.checkForUpdates, 5000);
return this.windowUtils.injectScript(this.config.getPath('client_script'));
}