From 559ef155f24372aa31e3ecb8381e345281b66460 Mon Sep 17 00:00:00 2001 From: Kiran Niranjan Date: Fri, 15 Nov 2024 12:55:41 +0100 Subject: [PATCH] SDA-4714 - Fix uts --- spec/appMenu.spec.ts | 4 ++-- spec/plistHandler.spec.ts | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/spec/appMenu.spec.ts b/spec/appMenu.spec.ts index eaa391bf5..393a39784 100644 --- a/spec/appMenu.spec.ts +++ b/spec/appMenu.spec.ts @@ -3,12 +3,12 @@ import { autoLaunchInstance } from '../src/app/auto-launch-controller'; import { config } from '../src/app/config-handler'; import { exportCrashDumps, exportLogs } from '../src/app/reports-handler'; import { updateAlwaysOnTop } from '../src/app/window-actions'; +import { windowHandler } from '../src/app/window-handler'; import { zoomIn, zoomOut } from '../src/app/window-utils'; +import { apiName } from '../src/common/api-interface'; import * as envMock from '../src/common/env'; import { logger } from '../src/common/logger'; import { BrowserWindow, dialog, session, shell } from './__mocks__/electron'; -import { windowHandler } from '../src/app/window-handler'; -import { apiName } from '../src/common/api-interface'; jest.mock('../src/app/stores', () => { const mock = new Map(); diff --git a/spec/plistHandler.spec.ts b/spec/plistHandler.spec.ts index d6d966ae9..6d7f1427b 100644 --- a/spec/plistHandler.spec.ts +++ b/spec/plistHandler.spec.ts @@ -1,5 +1,44 @@ import { getAllUserDefaults } from '../src/app/plist-handler'; +jest.mock('../src/app/config-handler', () => { + return { + ConfigFieldsDefaultValues: {}, + CloudConfigDataTypes: { + NOT_SET: 'NOT_SET', + ENABLED: 'ENABLED', + DISABLED: 'DISABLED', + }, + config: { + getConfigFields: jest.fn(() => { + return { + minimizeOnClose: 'ENABLED', + launchOnStartup: 'ENABLED', + alwaysOnTop: 'ENABLED', + isAlwaysOnTop: 'ENABLED', + bringToFront: 'ENABLED', + devToolsEnabled: true, + }; + }), + getGlobalConfigFields: jest.fn(() => { + return { + devToolsEnabled: true, + }; + }), + getFilteredCloudConfigFields: jest.fn(() => { + return { + devToolsEnabled: true, + }; + }), + getCloudConfigFields: jest.fn(() => { + return { + devToolsEnabled: true, + }; + }), + updateUserConfig: jest.fn(), + }, + }; +}); + describe('Plist Handler', () => { it('should return config object', () => { expect(getAllUserDefaults()).toStrictEqual({