Fix Work item unit tests for Vue 3 mode
What does this MR do and why?
This merge request fixes Work item unit tests for Vue 3 mode. The changes primarily focus on updating the test files to ensure compatibility with Vue 3 and improving the overall test coverage for the Work Items feature.
Specifically, this MR:
- Adds
data-testid
attributes to various components in thework_item_time_tracking.vue
file to improve test selectability. - Updates the
work_item_labels_spec.js
file to use a more accurate method of checking for scoped labels. - Modifies the
todos_toggle_spec.js
andwork_item_drawer_spec.js
files to use component stubs, which can help isolate component behavior in tests. - Significantly refactors the
work_item_time_tracking_spec.js
file to useshallowMount
instead ofmount
, updates import statements, and modifies test selectors to use the newly addeddata-testid
attributes.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
No visual changes
How to set up and validate locally
Run the following tests in Vue 3 mode:
VUE_VERSION=3 yarn jest ee/spec/frontend/work_items/components/work_item_labels_spec.js
VUE_VERSION=3 yarn jest spec/frontend/work_items/components/shared/todos_toggle_spec.js
VUE_VERSION=3 yarn jest spec/frontend/work_items/components/work_item_drawer_spec.js
VUE_VERSION=3 yarn jest spec/frontend/work_items/components/work_item_time_tracking_spec.js
Edited by Natalia Tepluhina