diff --git a/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/trusted_apps_page.test.tsx b/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/trusted_apps_page.test.tsx index 69c7616b502c8..d891731f6d768 100644 --- a/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/trusted_apps_page.test.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/trusted_apps_page.test.tsx @@ -201,7 +201,7 @@ describe('When on the Trusted Apps Page', () => { fireEvent.change( getByTestId('addTrustedAppFlyout-createForm-conditionsBuilder-group1-entry0-value'), - { target: { value: 'SOME$HASH#HERE' } } + { target: { value: '44ed10b389dbcd1cf16cec79d16d7378' } } ); fireEvent.change(getByTestId('addTrustedAppFlyout-createForm-descriptionField'), { @@ -363,6 +363,29 @@ describe('When on the Trusted Apps Page', () => { }); }); }); + + describe('and when the form data is not valid', () => { + it('should not enable the Flyout Add button with an invalid hash', async () => { + const renderResult = await renderAndClickAddButton(); + const { getByTestId } = renderResult; + + reactTestingLibrary.act(() => { + fireEvent.change(getByTestId('addTrustedAppFlyout-createForm-nameTextField'), { + target: { value: 'trusted app A' }, + }); + + fireEvent.change( + getByTestId('addTrustedAppFlyout-createForm-conditionsBuilder-group1-entry0-value'), + { target: { value: 'invalid hash' } } + ); + }); + + const flyoutAddButton = getByTestId( + 'addTrustedAppFlyout-createButton' + ) as HTMLButtonElement; + expect(flyoutAddButton.disabled).toBe(true); + }); + }); }); describe('and there are no trusted apps', () => {