Merge branch 'master' into SDA-1897

This commit is contained in:
mattias-symphony
2020-03-23 09:35:00 +01:00
committed by GitHub
2 changed files with 10 additions and 5 deletions
+8 -3
View File
@@ -6,11 +6,16 @@ jest.mock('electron-log');
jest.mock('../src/app/config-handler', () => {
return {
CloudConfigDataTypes: {
NOT_SET: 'NOT_SET',
ENABLED: 'ENABLED',
DISABLED: 'DISABLED',
},
config: {
getGlobalConfigFields: jest.fn(() => ''),
getConfigFields: jest.fn(() => {
return {
launchOnStartup: true,
launchOnStartup: 'ENABLED',
};
}),
updateUserConfig: jest.fn(),
@@ -23,7 +28,7 @@ describe('auto launch controller', async () => {
beforeEach(() => {
jest.spyOn(config, 'getConfigFields').mockImplementation(() => {
return {
launchOnStartup: true,
launchOnStartup: 'ENABLED',
};
});
jest.clearAllMocks();
@@ -61,7 +66,7 @@ describe('auto launch controller', async () => {
it('should disable AutoLaunch when `handleAutoLaunch` is called', async () => {
jest.spyOn(config, 'getConfigFields').mockImplementation(() => {
return {
launchOnStartup: false,
launchOnStartup: 'DISABLED',
};
});
const spyFn = 'disableAutoLaunch';
+2 -2
View File
@@ -2,7 +2,7 @@ import { app, LoginItemSettings } from 'electron';
import { isMac } from '../common/env';
import { logger } from '../common/logger';
import { config, IConfig } from './config-handler';
import { CloudConfigDataTypes, config, IConfig } from './config-handler';
const { autoLaunchPath }: IConfig = config.getConfigFields([ 'autoLaunchPath' ]);
@@ -57,7 +57,7 @@ class AutoLaunchController {
const { launchOnStartup }: IConfig = config.getConfigFields([ 'launchOnStartup' ]);
const { openAtLogin: isAutoLaunchEnabled }: LoginItemSettings = this.isAutoLaunchEnabled();
if (typeof launchOnStartup === 'boolean' && launchOnStartup) {
if (launchOnStartup === CloudConfigDataTypes.ENABLED) {
if (!isAutoLaunchEnabled) {
this.enableAutoLaunch();
}