From 2dd1d0f9a970edc60c213f768cae20de533adc9d Mon Sep 17 00:00:00 2001 From: Thuan Vo Date: Mon, 25 Sep 2023 22:57:11 -0700 Subject: [PATCH] chore(ts): move const to utils --- src/app/Shared/Services/Settings.service.tsx | 2 +- src/app/Shared/Services/service.types.ts | 4 ---- src/app/Shared/Services/service.utils.ts | 6 +++++- src/test/Dashboard/Dashboard.test.tsx | 2 ++ 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/app/Shared/Services/Settings.service.tsx b/src/app/Shared/Services/Settings.service.tsx index 25a116069c..8cfcd89f67 100644 --- a/src/app/Shared/Services/Settings.service.tsx +++ b/src/app/Shared/Services/Settings.service.tsx @@ -24,9 +24,9 @@ import { AutomatedAnalysisRecordingConfig, FeatureLevel, defaultAutomatedAnalysisRecordingConfig, - defaultChartControllerConfig, ChartControllerConfig, } from './service.types'; +import { defaultChartControllerConfig } from './service.utils'; export class SettingsService { private readonly _featureLevel$ = new BehaviorSubject( diff --git a/src/app/Shared/Services/service.types.ts b/src/app/Shared/Services/service.types.ts index fe7137790a..6835da6da2 100644 --- a/src/app/Shared/Services/service.types.ts +++ b/src/app/Shared/Services/service.types.ts @@ -51,10 +51,6 @@ export interface ChartControllerConfig { minRefresh: number; } -export const defaultChartControllerConfig: ChartControllerConfig = { - minRefresh: 10, -}; - // ====================================== // Login // ====================================== diff --git a/src/app/Shared/Services/service.utils.ts b/src/app/Shared/Services/service.utils.ts index 077ae2cbef..a43f0171d5 100644 --- a/src/app/Shared/Services/service.utils.ts +++ b/src/app/Shared/Services/service.utils.ts @@ -18,7 +18,7 @@ import * as React from 'react'; import { BehaviorSubject } from 'rxjs'; import { automatedAnalysisRecordingName, RecordingAttributes, Target } from './api.types'; import { MatchExpressionService } from './MatchExpression.service'; -import { AutomatedAnalysisRecordingConfig } from './service.types'; +import { AutomatedAnalysisRecordingConfig, ChartControllerConfig } from './service.types'; // ====================================== // Match Expression @@ -30,6 +30,10 @@ export const MatchedTargetsServiceContext = React.createContext(new BehaviorSubj // ====================================== // Setting // ====================================== +export const defaultChartControllerConfig: ChartControllerConfig = { + minRefresh: 10, +}; + export const automatedAnalysisConfigToRecordingAttributes = ( config: AutomatedAnalysisRecordingConfig, ): RecordingAttributes => { diff --git a/src/test/Dashboard/Dashboard.test.tsx b/src/test/Dashboard/Dashboard.test.tsx index 0a0907cf50..659f5b521a 100644 --- a/src/test/Dashboard/Dashboard.test.tsx +++ b/src/test/Dashboard/Dashboard.test.tsx @@ -19,6 +19,7 @@ import { store } from '@app/Shared/Redux/ReduxStore'; import { Target } from '@app/Shared/Services/api.types'; import { NotificationsContext, NotificationsInstance } from '@app/Shared/Services/Notifications.service'; import { FeatureLevel } from '@app/Shared/Services/service.types'; +import { defaultChartControllerConfig } from '@app/Shared/Services/service.utils'; import { defaultServices, ServiceContext } from '@app/Shared/Services/Services'; import { defaultDatetimeFormat } from '@i18n/datetime'; import { createMemoryHistory } from 'history'; @@ -56,6 +57,7 @@ jest.spyOn(defaultServices.settings, 'featureLevel').mockReturnValue(of(FeatureL jest.spyOn(defaultServices.settings, 'datetimeFormat').mockReturnValue(of(defaultDatetimeFormat)); jest.spyOn(defaultServices.settings, 'themeSetting').mockReturnValue(of(ThemeSetting.LIGHT)); jest.spyOn(defaultServices.settings, 'media').mockReturnValue(of()); +jest.spyOn(defaultServices.settings, 'chartControllerConfig').mockReturnValue(defaultChartControllerConfig); const history = createMemoryHistory({ initialEntries: ['/'] });