Fix spec violations in add_edit_schedule_modal_spec.js
requested to merge 413340-fix-spec-violations-in-ee-spec-frontend-oncall_schedule-add_edit_schedule_modal_spec-js-2 into master
What does this MR do and why?
The main changes listed as spec violations are:
- getting rid of mocking
data()
- getting rid of
wrapper.vm.$refs.addEditScheduleRotationModal.hide = mockHideModal;
Additionally:
- I deleted two separate functions for creating the component and use only one in the whole file. This allowed for removing outdated
{ mocks: { $apollo ...}}
onmount
- I consolidated assertions for creating and editing schedules. Previously they where tested with the mock once and then just as calls to GraphQL API.
- I reorganized the file a bit, so that all the declarations are in one place at the top.
- I refactored mocks to share one defined object and only overwrite the properties needed in tests.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Here's the comparison of assertions before and after refactor:
Before | After |
---|---|
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
- Checkout the branch locally
- Run
yarn jest ee/spec/frontend/oncall_schedule/add_edit_schedule_modal_spec.js
to validate the refactored spec - Run
yarn jest ee/spec/frontend/oncall_schedule
to validate the refactored mocks for the whole module
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #413340 (closed)
Edited by Paulina Sedlak-Jakubowska