Skip to content

Commit

Permalink
Not resetting server log level if level is defined (elastic#83651)
Browse files Browse the repository at this point in the history
  • Loading branch information
ymao1 authored Nov 18, 2020
1 parent 938b762 commit 4b603da
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { coreMock } from 'src/core/public/mocks';

describe('ServerLogParamsFields renders', () => {
const mocks = coreMock.createSetup();
const editAction = jest.fn();

test('all params fields is rendered', () => {
const actionParams = {
Expand All @@ -22,14 +23,15 @@ describe('ServerLogParamsFields renders', () => {
<ServerLogParamsFields
actionParams={actionParams}
errors={{ message: [] }}
editAction={() => {}}
editAction={editAction}
index={0}
defaultMessage={'test default message'}
docLinks={{ ELASTIC_WEBSITE_URL: '', DOC_LINK_VERSION: '' } as DocLinksStart}
toastNotifications={mocks.notifications.toasts}
http={mocks.http}
/>
);
expect(editAction).not.toHaveBeenCalled();
expect(wrapper.find('[data-test-subj="loggingLevelSelect"]').length > 0).toBeTruthy();
expect(
wrapper.find('[data-test-subj="loggingLevelSelect"]').first().prop('value')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ export const ServerLogParamsFields: React.FunctionComponent<ActionParamsProps<
];

useEffect(() => {
editAction('level', 'info', index);
if (!actionParams?.level) {
editAction('level', 'info', index);
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

Expand Down

0 comments on commit 4b603da

Please sign in to comment.