-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Unified Observability] Add feature flag for the new overview page (#…
…119193) * Add feature flag to display a blank overview page when enabled * Add tests for overview page feature flag * Fix types * Fix more types * Remove duplicated BucketSize type * fix linter Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
- Loading branch information
1 parent
d9ee4d7
commit 2c41962
Showing
12 changed files
with
333 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
x-pack/plugins/observability/public/pages/overview/index.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
import React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
import * as PluginContext from '../../hooks/use_plugin_context'; | ||
import { PluginContextValue } from '../../context/plugin_context'; | ||
import { OverviewPage } from './'; | ||
import { OverviewPage as OldOverviewPage } from './old_overview_page'; | ||
import { OverviewPage as NewOverviewPage } from './overview_page'; | ||
|
||
describe('Overview page', () => { | ||
it('should render the old overview page when feature flag is disabled', () => { | ||
const pluginContext = { | ||
config: { | ||
unsafe: { | ||
overviewNext: { enabled: false }, | ||
}, | ||
}, | ||
}; | ||
|
||
jest | ||
.spyOn(PluginContext, 'usePluginContext') | ||
.mockReturnValue(pluginContext as PluginContextValue); | ||
|
||
const component = shallow(<OverviewPage routeParams={{ query: {} }} />); | ||
expect(component.find(OldOverviewPage)).toHaveLength(1); | ||
expect(component.find(NewOverviewPage)).toHaveLength(0); | ||
}); | ||
|
||
it('should render the new overview page when feature flag is enabled', () => { | ||
const pluginContext = { | ||
config: { | ||
unsafe: { | ||
overviewNext: { enabled: true }, | ||
}, | ||
}, | ||
}; | ||
|
||
jest | ||
.spyOn(PluginContext, 'usePluginContext') | ||
.mockReturnValue(pluginContext as PluginContextValue); | ||
|
||
const component = shallow(<OverviewPage routeParams={{ query: {} }} />); | ||
expect(component.find(OldOverviewPage)).toHaveLength(0); | ||
expect(component.find(NewOverviewPage)).toHaveLength(1); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.