Skip to content

Commit

Permalink
Fixes failing test and added new test case
Browse files Browse the repository at this point in the history
  • Loading branch information
dasansol92 committed Mar 22, 2021
1 parent 2805afe commit 95da70b
Showing 1 changed file with 24 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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'), {
Expand Down Expand Up @@ -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', () => {
Expand Down

0 comments on commit 95da70b

Please sign in to comment.