Fix unit test. Get rid of snapshots and use query element instead (#95656)

This commit is contained in:
David Sánchez 2021-03-30 12:12:33 +02:00 committed by GitHub
parent 9931b8bc1d
commit 41e247f29f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 5577 deletions

View file

@ -43,8 +43,7 @@ jest.mock('@elastic/eui/lib/services/accessibility/html_id_generator', () => ({
jest.mock('../../../../common/hooks/use_experimental_features');
const useIsExperimentalFeatureEnabledMock = useIsExperimentalFeatureEnabled as jest.Mock;
// Failing: See https://github.com/elastic/kibana/issues/95596
describe.skip('When on the Trusted Apps Page', () => {
describe('When on the Trusted Apps Page', () => {
const expectedAboutInfo =
'Add a trusted application to improve performance or alleviate conflicts with other applications running on your hosts. Trusted applications will be applied to hosts running Endpoint Security.';
@ -716,12 +715,16 @@ describe.skip('When on the Trusted Apps Page', () => {
it('should hide agents policy if feature flag is disabled', async () => {
useIsExperimentalFeatureEnabledMock.mockReturnValue(false);
const renderResult = await renderAndClickAddButton();
expect(renderResult).toMatchSnapshot();
expect(
renderResult.queryByTestId('addTrustedAppFlyout-createForm-policySelection')
).toBeNull();
});
it('should display agents policy if feature flag is enabled', async () => {
useIsExperimentalFeatureEnabledMock.mockReturnValue(true);
const renderResult = await renderAndClickAddButton();
expect(renderResult).toMatchSnapshot();
expect(
renderResult.queryByTestId('addTrustedAppFlyout-createForm-policySelection')
).toBeTruthy();
});
});
});