Skip to content

Commit

Permalink
Not resetting server log level if level is defined (#83651) (#83719)
Browse files Browse the repository at this point in the history
  • Loading branch information
ymao1 committed Nov 18, 2020
1 parent 5257f0d commit c87612c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
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
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 c87612c

Please sign in to comment.