From 4cf00236086ffddd0b1f3b06e48a9162c48b84a1 Mon Sep 17 00:00:00 2001 From: Davis Plumlee Date: Mon, 17 Aug 2020 12:19:48 -0400 Subject: [PATCH] addresses comments --- .../add_exception_modal/index.test.tsx | 23 +++++++++---------- .../edit_exception_modal/index.test.tsx | 22 +++++++++--------- 2 files changed, 22 insertions(+), 23 deletions(-) diff --git a/x-pack/plugins/security_solution/public/common/components/exceptions/add_exception_modal/index.test.tsx b/x-pack/plugins/security_solution/public/common/components/exceptions/add_exception_modal/index.test.tsx index d5ab0672246dd..2b713636862bb 100644 --- a/x-pack/plugins/security_solution/public/common/components/exceptions/add_exception_modal/index.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/exceptions/add_exception_modal/index.test.tsx @@ -55,7 +55,7 @@ describe('When the add exception modal is opened', () => { })); (useAddOrUpdateException as jest.Mock).mockImplementation(() => [ { isLoading: false }, - () => {}, + jest.fn(), ]); (useFetchOrCreateRuleExceptionList as jest.Mock).mockImplementation(() => [ false, @@ -96,8 +96,8 @@ describe('When the add exception modal is opened', () => { ruleIndices={[]} ruleName={ruleName} exceptionListType={'endpoint'} - onCancel={() => {}} - onConfirm={() => {}} + onCancel={jest.fn()} + onConfirm={jest.fn()} /> ); @@ -117,8 +117,8 @@ describe('When the add exception modal is opened', () => { ruleIndices={['filebeat-*']} ruleName={ruleName} exceptionListType={'endpoint'} - onCancel={() => {}} - onConfirm={() => {}} + onCancel={jest.fn()} + onConfirm={jest.fn()} /> ); @@ -157,8 +157,8 @@ describe('When the add exception modal is opened', () => { ruleIndices={['filebeat-*']} ruleName={ruleName} exceptionListType={'endpoint'} - onCancel={() => {}} - onConfirm={() => {}} + onCancel={jest.fn()} + onConfirm={jest.fn()} alertData={alertDataMock} /> @@ -208,8 +208,8 @@ describe('When the add exception modal is opened', () => { ruleIndices={['filebeat-*']} ruleName={ruleName} exceptionListType={'detection'} - onCancel={() => {}} - onConfirm={() => {}} + onCancel={jest.fn()} + onConfirm={jest.fn()} alertData={alertDataMock} /> @@ -276,8 +276,8 @@ describe('When the add exception modal is opened', () => { ruleIndices={['filebeat-*']} ruleName={ruleName} exceptionListType={'endpoint'} - onCancel={() => {}} - onConfirm={() => {}} + onCancel={jest.fn()} + onConfirm={jest.fn()} alertData={alertDataMock} /> @@ -290,7 +290,6 @@ describe('When the add exception modal is opened', () => { wrapper.find('button[data-test-subj="add-exception-confirm-button"]').getDOMNode() ).not.toBeDisabled(); }); - it('should render the exception builder', () => { expect(wrapper.find('[data-test-subj="alert-exception-builder"]').exists()).toBeTruthy(); }); diff --git a/x-pack/plugins/security_solution/public/common/components/exceptions/edit_exception_modal/index.test.tsx b/x-pack/plugins/security_solution/public/common/components/exceptions/edit_exception_modal/index.test.tsx index 2bc71ac5fea13..8ad80eba569c7 100644 --- a/x-pack/plugins/security_solution/public/common/components/exceptions/edit_exception_modal/index.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/exceptions/edit_exception_modal/index.test.tsx @@ -55,7 +55,7 @@ describe('When the edit exception modal is opened', () => { }); (useAddOrUpdateException as jest.Mock).mockImplementation(() => [ { isLoading: false }, - () => {}, + jest.fn(), ]); (useFetchIndexPatterns as jest.Mock).mockImplementation(() => [ { @@ -86,8 +86,8 @@ describe('When the edit exception modal is opened', () => { ruleIndices={[]} ruleName={ruleName} exceptionListType={'endpoint'} - onCancel={() => {}} - onConfirm={() => {}} + onCancel={jest.fn()} + onConfirm={jest.fn()} exceptionItem={getExceptionListItemSchemaMock()} /> @@ -114,8 +114,8 @@ describe('When the edit exception modal is opened', () => { ruleIndices={['filebeat-*']} ruleName={ruleName} exceptionListType={'endpoint'} - onCancel={() => {}} - onConfirm={() => {}} + onCancel={jest.fn()} + onConfirm={jest.fn()} exceptionItem={exceptionItemMock} /> @@ -156,8 +156,8 @@ describe('When the edit exception modal is opened', () => { ruleIndices={['filebeat-*']} ruleName={ruleName} exceptionListType={'endpoint'} - onCancel={() => {}} - onConfirm={() => {}} + onCancel={jest.fn()} + onConfirm={jest.fn()} exceptionItem={getExceptionListItemSchemaMock()} /> @@ -199,8 +199,8 @@ describe('When the edit exception modal is opened', () => { ruleIndices={['filebeat-*']} ruleName={ruleName} exceptionListType={'detection'} - onCancel={() => {}} - onConfirm={() => {}} + onCancel={jest.fn()} + onConfirm={jest.fn()} exceptionItem={getExceptionListItemSchemaMock()} /> @@ -238,8 +238,8 @@ describe('When the edit exception modal is opened', () => { ruleIndices={['filebeat-*']} ruleName={ruleName} exceptionListType={'detection'} - onCancel={() => {}} - onConfirm={() => {}} + onCancel={jest.fn()} + onConfirm={jest.fn()} exceptionItem={exceptionItemMock} />