mirror of
https://github.com/finos/SymphonyElectron.git
synced 2024-11-21 16:38:41 -06:00
fix: SDA-1890 (Fix auto launch on startup for cloud config) (#934)
* SDA-1890 - Fix auto launch on start up for cloud config * SDA-1890 - Fix unit tests
This commit is contained in:
parent
a104af42c6
commit
d61473febe
@ -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,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();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user