diff --git a/lib/config.js b/lib/config.js index 0769813..b91a1e9 100644 --- a/lib/config.js +++ b/lib/config.js @@ -10,20 +10,18 @@ export const config = { description: 'An address of server which will be used in order to send code and analyse it', order: 1, }, + sessionToken: { + type: 'string', + default: '', + title: 'Session token', + description: 'Clear this session token to make re-login', + order: 2, + }, analyseOnChange: { type: 'boolean', default: true, title: 'Analyse on change', description: 'Allows perform analysis on every time files are changed (with custom delay). Default: true', - order: 2, - }, - analyseOnChangeDelay: { - type: 'integer', - default: 10, - minimum: 1, - maximum: 3600, - title: 'Delay for analyse on change', - description: 'Delay in seconds between starting analysis for changed files. From 1 sec to 1 hour (3600 sec). Default: 10 sec', order: 3, }, reScanOnStart: { @@ -33,18 +31,20 @@ export const config = { description: 'Allows performing full scanning project on start. Otherwise: only analysis with stored bundle', order: 4, }, + analyseOnChangeDelay: { + type: 'integer', + default: 10, + minimum: 1, + maximum: 3600, + title: 'Delay for analyse on change', + description: 'Delay in seconds between starting analysis for changed files. From 1 sec to 1 hour (3600 sec). Default: 10 sec', + order: 5, + }, debugLog: { type: 'boolean', default: false, title: 'Use debug log', description: 'Allows output debug messages to console. Default: false', - order: 5, - }, - sessionToken: { - type: 'string', - default: '', - title: 'Session token', - description: 'Clear this session token to make re-login', order: 6, }, }; diff --git a/lib/modules/PluginManager.js b/lib/modules/PluginManager.js index ed8e008..340bdce 100644 --- a/lib/modules/PluginManager.js +++ b/lib/modules/PluginManager.js @@ -117,8 +117,10 @@ class PluginManager { const onClickLogin = async () => { Store.set(STORE_KEYS.loginInProcess, true); - this.loginDialog.dismiss(); - this.loginDialog = null; + if (this.loginDialog) { + this.loginDialog.dismiss(); + this.loginDialog = null; + } await AuthModule.login(); }; diff --git a/spec/deepcode-spec.js b/spec/deepcode-spec.js index 473fac4..141a05c 100644 --- a/spec/deepcode-spec.js +++ b/spec/deepcode-spec.js @@ -61,20 +61,23 @@ describe('Deepcode Plugin tests', () => { waitsForPromise(activationPromise); }); - const checkFiltersPromise = new Promise(resolve => { - dcPackage.checkFilters(); - setTimeout(() => { + it('fetched filters from server', () => { + + dcPackage.setPluginState({ + [STORE_KEYS.allowedFiles]: {}, + }); + + const checkFiltersPromise = new Promise(resolve => { + dcPackage.checkFilters(); resolve(); - }, 1000); - }); + }); - it('fetched filters from server', () => { - waitsForPromise(checkFiltersPromise); + waitsForPromise(() => checkFiltersPromise); const state = dcPackage.getPluginState(); console.log('deepcode-spec.js, [75]: ', { state }); - expect(true).toEqual(true); + expect(state[STORE_KEYS.allowedFiles]).toEqual(mockState[STORE_KEYS.allowedFiles]); }) }) });