Remove unused props parameter from CI spec factories

What does this MR do and why?

This merge request removes one unused parameter from a Jest spec factory in 16 spec files under spec/frontend/ci and ee/spec/frontend/ci.

In 15 files the parameter is named props. In spec/frontend/ci/pipeline_details/test_reports/test_reports_spec.js it is named getterStubs.

Each factory declared the parameter with an empty object default, such as props = {}. The factory then spread the parameter into an object, such as propsData: { ...defaultProps, ...props }.

No call in the file supplied a value for the parameter. The parameter always held an empty object. Spreading an empty object into an object literal adds no keys. So the spread had no effect.

The change removes the parameter and the spread. It cannot change what a component receives.

One file needed one extra edit. In spec/frontend/ci/catalog/components/ci_catalog_home_spec.js, the removed spread was the only content of propsData. The empty propsData: {} block also goes.

No application code changes. Only spec files change.

-  const createComponent = ({ props = {}, handler = queryHandler } = {}) => {
+  const createComponent = ({ handler = queryHandler } = {}) => {
     wrapper = shallowMount(Component, {
       propsData: {
         ...defaultProps,
-        ...props,
       },

The cleanup is worth doing for these reasons. The parameter advertised a control that no test used. A reader cannot tell which factory parameters work. The reader must check every call in the file. Somebody who copies the pattern into a new test gets setup that does nothing.

References

This merge request covers the ci spec trees. A sibling merge request covers the work_items spec trees: !258712 (merged)

How to set up and validate locally

There is nothing to set up. This merge request changes only spec files. CI runs the Jest suites in both Vue lanes.

One suite does not run in a local checkout without generated fixtures. spec/frontend/ci/pipeline_details/test_reports/test_reports_spec.js needs test_fixtures/pipelines/test_report.json. This failure exists on the default branch too. This change does not cause it. CI generates the fixture.

🤖 AI-generated

Edited by Justin Ho Tuan Duong

Merge request reports

Loading
Loading