-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
353 additions
and
344 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,7 @@ import { | |
import { useGetCasesMockState, connectorsMock } from '../../containers/mock'; | ||
|
||
import { StatusAll } from '../../../common/ui/types'; | ||
import { CaseSeverity, CaseStatuses } from '../../../common/api'; | ||
import { CaseStatuses } from '../../../common/api'; | ||
import { SECURITY_SOLUTION_OWNER } from '../../../common/constants'; | ||
import { getEmptyTagValue } from '../empty_value'; | ||
import { useKibana } from '../../common/lib/kibana'; | ||
|
@@ -360,60 +360,21 @@ describe('AllCasesListGeneric', () => { | |
}); | ||
|
||
it('should call onRowClick when clicking a case with modal=true', async () => { | ||
const theCase = defaultGetCases.data.cases[0]; | ||
|
||
const wrapper = mount( | ||
<TestProviders> | ||
<AllCasesList isSelectorView={true} onRowClick={onRowClick} /> | ||
</TestProviders> | ||
); | ||
|
||
wrapper.find('[data-test-subj="cases-table-row-select-1"]').first().simulate('click'); | ||
wrapper | ||
.find(`[data-test-subj="cases-table-row-select-${theCase.id}"]`) | ||
.first() | ||
.simulate('click'); | ||
|
||
await waitFor(() => { | ||
expect(onRowClick).toHaveBeenCalledWith({ | ||
assignees: [{ uid: 'u_J41Oh6L9ki-Vo2tOogS8WRTENzhHurGtRc87NgEAlkc_0' }], | ||
closedAt: null, | ||
closedBy: null, | ||
comments: [], | ||
connector: { fields: null, id: '123', name: 'My Connector', type: '.jira' }, | ||
createdAt: '2020-02-19T23:06:33.798Z', | ||
createdBy: { | ||
email: '[email protected]', | ||
fullName: 'Leslie Knope', | ||
username: 'lknope', | ||
}, | ||
description: 'Security banana Issue', | ||
severity: CaseSeverity.LOW, | ||
duration: null, | ||
externalService: { | ||
connectorId: '123', | ||
connectorName: 'connector name', | ||
externalId: 'external_id', | ||
externalTitle: 'external title', | ||
externalUrl: 'basicPush.com', | ||
pushedAt: '2020-02-20T15:02:57.995Z', | ||
pushedBy: { | ||
email: '[email protected]', | ||
fullName: 'Leslie Knope', | ||
username: 'lknope', | ||
}, | ||
}, | ||
id: '1', | ||
owner: SECURITY_SOLUTION_OWNER, | ||
status: 'open', | ||
tags: ['coke', 'pepsi'], | ||
title: 'Another horrible breach!!', | ||
totalAlerts: 0, | ||
totalComment: 0, | ||
updatedAt: '2020-02-20T15:02:57.995Z', | ||
updatedBy: { | ||
email: '[email protected]', | ||
fullName: 'Leslie Knope', | ||
username: 'lknope', | ||
}, | ||
version: 'WzQ3LDFd', | ||
settings: { | ||
syncAlerts: true, | ||
}, | ||
}); | ||
expect(onRowClick).toHaveBeenCalledWith(theCase); | ||
}); | ||
}); | ||
|
||
|
@@ -746,6 +707,10 @@ describe('AllCasesListGeneric', () => { | |
it('Renders bulk action', async () => { | ||
const result = appMockRenderer.render(<AllCasesList />); | ||
|
||
act(() => { | ||
userEvent.click(result.getByTestId('checkboxSelectAll')); | ||
}); | ||
|
||
act(() => { | ||
userEvent.click(result.getByText('Bulk actions')); | ||
}); | ||
|
@@ -760,10 +725,9 @@ describe('AllCasesListGeneric', () => { | |
'Bulk update status: %s', | ||
async (status) => { | ||
const result = appMockRenderer.render(<AllCasesList />); | ||
const theCase = useGetCasesMockState.data.cases[0]; | ||
|
||
act(() => { | ||
userEvent.click(result.getByTestId(`checkboxSelectRow-${theCase.id}`)); | ||
userEvent.click(result.getByTestId('checkboxSelectAll')); | ||
}); | ||
|
||
act(() => { | ||
|
@@ -787,7 +751,11 @@ describe('AllCasesListGeneric', () => { | |
await waitForComponentToUpdate(); | ||
|
||
expect(updateCasesSpy).toBeCalledWith( | ||
[{ id: theCase.id, version: theCase.version, status }], | ||
useGetCasesMockState.data.cases.map(({ id, version }) => ({ | ||
id, | ||
version, | ||
status, | ||
})), | ||
expect.anything() | ||
); | ||
} | ||
|
@@ -857,7 +825,9 @@ describe('AllCasesListGeneric', () => { | |
|
||
it.each(statusTests)('update the status of a case: %s', async (status) => { | ||
const res = appMockRenderer.render(<AllCasesList />); | ||
const theCase = defaultGetCases.data.cases[0]; | ||
const openCase = useGetCasesMockState.data.cases[0]; | ||
const inProgressCase = useGetCasesMockState.data.cases[1]; | ||
const theCase = status === CaseStatuses.open ? inProgressCase : openCase; | ||
|
||
await waitFor(() => { | ||
expect(res.getByTestId(`case-action-popover-button-${theCase.id}`)).toBeInTheDocument(); | ||
|
@@ -887,7 +857,7 @@ describe('AllCasesListGeneric', () => { | |
|
||
await waitFor(() => { | ||
expect(updateCasesSpy).toHaveBeenCalledWith( | ||
[{ id: 'basic-case-id', status, version: 'WzQ3LDFd' }], | ||
[{ id: theCase.id, status, version: theCase.version }], | ||
expect.anything() | ||
); | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.