Skip to content

Commit

Permalink
fix: mock preferences in explorer test
Browse files Browse the repository at this point in the history
  • Loading branch information
arjunlalb committed Sep 21, 2023
1 parent 7bb7cee commit 4437af9
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ import {
LayoutChangeService,
NavigationService,
PreferenceService,
PreferenceValue,
RelativeTimeRange,
StorageType,
TimeDuration,
TimeRangeService,
TimeUnit
Expand Down Expand Up @@ -71,6 +73,7 @@ describe('Explorer component', () => {
const testTimeRange = new RelativeTimeRange(new TimeDuration(15, TimeUnit.Minute));
const createComponent = createComponentFactory({
component: ExplorerComponent,
shallow: true,
imports: [
ExplorerModule.withDashboardBuilderFactory({
useFactory: (metadataService: MetadataService, filterBuilderLookupService: FilterBuilderLookupService) =>
Expand Down Expand Up @@ -111,7 +114,10 @@ describe('Explorer component', () => {
}
},
mockProvider(PreferenceService, {
get: jest.fn().mockReturnValue(of(true))
get: jest.fn().mockReturnValue(of(true)),
getOnce: jest
.fn()
.mockImplementation((_key: string, defaultValue: PreferenceValue, _storageType: StorageType) => defaultValue)
}),
...getMockFlexLayoutProviders()
]
Expand Down

0 comments on commit 4437af9

Please sign in to comment.