Skip to content

Commit e487eee

Browse files
committed
fix type issue and add test
1 parent 00a687f commit e487eee

File tree

1 file changed

+33
-3
lines changed

1 file changed

+33
-3
lines changed

x-pack/plugins/siem/public/pages/case/components/case_view/actions.test.tsx

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ import { mount } from 'enzyme';
99

1010
import { useDeleteCases } from '../../../../containers/case/use_delete_cases';
1111
import { TestProviders } from '../../../../mock';
12-
import { basicCase } from '../../../../containers/case/mock';
12+
import { basicCase, basicPush } from '../../../../containers/case/mock';
1313
import { CaseViewActions } from './actions';
14+
import * as i18n from './translations';
1415
jest.mock('../../../../containers/case/use_delete_cases');
1516
const useDeleteCasesMock = useDeleteCases as jest.Mock;
1617

@@ -34,7 +35,7 @@ describe('CaseView actions', () => {
3435
it('clicking trash toggles modal', () => {
3536
const wrapper = mount(
3637
<TestProviders>
37-
<CaseViewActions caseData={basicCase} />
38+
<CaseViewActions caseData={basicCase} currentExternalIncident={null} />
3839
</TestProviders>
3940
);
4041

@@ -54,7 +55,7 @@ describe('CaseView actions', () => {
5455
}));
5556
const wrapper = mount(
5657
<TestProviders>
57-
<CaseViewActions caseData={basicCase} />
58+
<CaseViewActions caseData={basicCase} currentExternalIncident={null} />
5859
</TestProviders>
5960
);
6061

@@ -64,4 +65,33 @@ describe('CaseView actions', () => {
6465
{ id: basicCase.id, title: basicCase.title },
6566
]);
6667
});
68+
it('displays active incident link', () => {
69+
const wrapper = mount(
70+
<TestProviders>
71+
<CaseViewActions
72+
caseData={basicCase}
73+
currentExternalIncident={{
74+
...basicPush,
75+
firstPushIndex: 5,
76+
lastPushIndex: 5,
77+
commentsToUpdate: [],
78+
hasDataToPush: false,
79+
}}
80+
/>
81+
</TestProviders>
82+
);
83+
84+
expect(wrapper.find('[data-test-subj="confirm-delete-case-modal"]').exists()).toBeFalsy();
85+
86+
wrapper
87+
.find('button[data-test-subj="property-actions-ellipses"]')
88+
.first()
89+
.simulate('click');
90+
expect(
91+
wrapper
92+
.find('[data-test-subj="property-actions-popout"]')
93+
.first()
94+
.prop('aria-label')
95+
).toEqual(i18n.VIEW_INCIDENT(basicPush.externalTitle));
96+
});
6797
});

0 commit comments

Comments
 (0)