import { act } from 'react-dom/test-utils' ; import { TestBed } from '@kbn/test/jest' ; import { licensingMock } from '../../../../../licensing/public/mocks' ; import { setupEnvironment } from '../../helpers' ; import { initTestBed } from '../init_test_bed' ; describe ( '<EditPolicy /> frozen phase' , ( ) => { let testBed ; const { server , httpRequestsMockHelpers } = setupEnvironment ( ) ; beforeAll ( ( ) => { jest . useFakeTimers ( ) ; } ) ; afterAll ( ( ) => { jest . useRealTimers ( ) ; server . restore ( ) ; } ) ; beforeEach ( async ( ) => { httpRequestsMockHelpers . setDefaultResponses ( ) ; await act ( async ( ) => { testBed = await initTestBed ( ) ; } ) ; const { component } = testBed ; component . update ( ) ; } ) ; describe ( 'on non-enterprise license' , ( ) => { beforeEach ( async ( ) => { httpRequestsMockHelpers . setDefaultResponses ( ) ; await act ( async ( ) => { testBed = await initTestBed ( { appServicesContext : { license : licensingMock . createLicense ( { license : { type : 'basic' } } ) , } , } ) ; } ) ; const { component } = testBed ; component . update ( ) ; } ) ; test ( 'should not be available' , async ( ) => { const { exists } = testBed ; expect ( exists ( 'frozen-phase' ) ) . toBe ( false ) ; } ) ; } ) ; } ) ;