-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Security Solution][Case] Attach alerts to cases: Tests #86305
Conversation
54fb8cd
to
fa5abae
Compare
fa5abae
to
4ad1478
Compare
a958454
to
20984ef
Compare
x-pack/plugins/case/server/routes/api/cases/status/get_status.test.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/security_solution/public/cases/components/add_comment/index.test.tsx
Show resolved
Hide resolved
x-pack/plugins/security_solution/public/cases/components/all_cases/status_filter.test.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/security_solution/public/cases/components/case_action_bar/index.test.tsx
Outdated
Show resolved
Hide resolved
it('it toggles the switch', async () => { | ||
const wrapper = mount(<SyncAlertsSwitch disabled={false} />); | ||
|
||
act(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should use waitFor
here instead. See: https://kentcdodds.com/blog/common-mistakes-with-react-testing-library. You can also get rid of the wrapper.update. that article says do the side effect, then wrap the expect in waitFor
:
it('it toggles the switch', async () => {
const wrapper = mount(<SyncAlertsSwitch disabled={false} />);
wrapper.find('button[data-test-subj="sync-alerts-switch"]').first().simulate('click');
await waitFor(() => {
expect(wrapper.find('[data-test-subj="sync-alerts-switch"]').first().prop('checked')).toBe(
false
);
});
});
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the article!
.../plugins/security_solution/public/cases/components/case_settings/sync_alerts_switch.test.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/security_solution/public/cases/components/create/form.test.tsx
Show resolved
Hide resolved
x-pack/plugins/security_solution/public/cases/components/create/sync_alerts_toggle.test.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/security_solution/public/cases/components/create/sync_alerts_toggle.test.tsx
Outdated
Show resolved
Hide resolved
14028ed
to
d725669
Compare
@elasticmachine merge upstream |
💚 Build SucceededMetrics [docs]Async chunks
History
To update your PR or re-run it, just comment with: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for making those changes. LGTM!
Co-authored-by: Steph Milovic <stephanie.milovic@elastic.co> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Steph Milovic <stephanie.milovic@elastic.co> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
… (#87861) Co-authored-by: Steph Milovic <stephanie.milovic@elastic.co> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Steph Milovic <stephanie.milovic@elastic.co> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
#87860) Co-authored-by: Steph Milovic <stephanie.milovic@elastic.co> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Steph Milovic <stephanie.milovic@elastic.co> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Summary
This PR adds and improves tests for the attach alerts to cases feature.
Checklist
Delete any items that are not applicable to this PR.
For maintainers