@@ -9,6 +9,7 @@ import { appFeatureFlagsFeaturesSelector } from 'uiSrc/slices/app/features'
99import { sendEventTelemetry } from 'uiSrc/telemetry'
1010import { HELP_LINKS } from 'uiSrc/pages/home/constants'
1111import * as appFeaturesSlice from 'uiSrc/slices/app/features'
12+ import { SideBar } from 'uiSrc/components/base/layout/sidebar'
1213import CreateCloud from './CreateCloud'
1314
1415jest . mock ( 'uiSrc/telemetry' , ( ) => ( {
@@ -37,15 +38,17 @@ beforeEach(() => {
3738 store . clearActions ( )
3839} )
3940
41+ const sideBarWithCreateCloud = < SideBar isExpanded = { false } > < CreateCloud /> </ SideBar >
42+
4043describe ( 'CreateCloud' , ( ) => {
4144 it ( 'should render' , ( ) => {
42- expect ( render ( < CreateCloud /> ) ) . toBeTruthy ( )
45+ expect ( render ( sideBarWithCreateCloud ) ) . toBeTruthy ( )
4346 } )
4447
4548 it ( 'should call proper actions on click cloud button' , ( ) => {
46- const { container } = render ( < CreateCloud /> )
49+ const { container } = render ( sideBarWithCreateCloud )
4750 const createCloudLink = container . querySelector (
48- '[data-test-subj ="create-cloud-nav-link "]' ,
51+ '[data-testid ="create-cloud-sidebar-item "]' ,
4952 )
5053
5154 fireEvent . click ( createCloudLink as Element )
@@ -69,9 +72,9 @@ describe('CreateCloud', () => {
6972 flag : true ,
7073 } ,
7174 } )
72- const { container } = render ( < CreateCloud /> )
75+ const { container } = render ( sideBarWithCreateCloud )
7376 const createCloudLink = container . querySelector (
74- '[data-test-subj ="create-cloud-nav-link "]' ,
77+ '[data-testid ="create-cloud-sidebar-item "]' ,
7578 )
7679
7780 fireEvent . click ( createCloudLink as Element )
@@ -86,7 +89,10 @@ describe('CreateCloud', () => {
8689
8790 it ( 'should not render if cloud ads feature flag is disabled' , ( ) => {
8891 mockFeatureFlags ( false )
89- const { container } = render ( < CreateCloud /> )
90- expect ( container ) . toBeEmptyDOMElement ( )
92+ const { container } = render ( sideBarWithCreateCloud )
93+ const createCloudLink = container . querySelector (
94+ '[data-testid="create-cloud-db-link"]' ,
95+ )
96+ expect ( createCloudLink ) . not . toBeInTheDocument ( )
9197 } )
9298} )
0 commit comments