spec/frontend/pages/projects/pipeline_schedules/shared/components/timezone_dropdown_spec.js failing

Job #3224678947 failed for 62af36cf:

FAIL spec/frontend/pages/projects/pipeline_schedules/shared/components/timezone_dropdown_spec.js
  ● Timezone Dropdown › Initialize › with dropdown already loaded › can take an $inputEl in the constructor
    expect(received).toBe(expected) // Object.is equality
    Expected: "Etc/UTC"
    Received: undefined
      43 |         const tzValue = 'Asia/Colombo';
      44 |
    > 45 |         expect($inputEl.val()).toBe('Etc/UTC');
         |                                ^
      46 |
      47 |         $(`${tzListSel}:contains('${tzStr}')`, $wrapper).trigger('click');
      48 |
      at Object.<anonymous> (spec/frontend/pages/projects/pipeline_schedules/shared/components/timezone_dropdown_spec.js:45:32)
  ● Timezone Dropdown › Initialize › with dropdown already loaded › will format data array of timezones into a list of offsets
    TypeError: Cannot read properties of undefined (reading 'forEach')
      59 |         const formatted = $wrapper.find(tzListSel).text();
      60 |
    > 61 |         data.forEach((item) => {
         |              ^
      62 |           expect(formatted).toContain(formatTimezone(item));
      63 |         });
      64 |       });
      at Object.<anonymous> (spec/frontend/pages/projects/pipeline_schedules/shared/components/timezone_dropdown_spec.js:61:14)
  ● Timezone Dropdown › Initialize › with dropdown already loaded › will format data array of timezones into a list of offsets
    expect.hasAssertions()
    Expected at least one assertion to be called but received none.
      66 |   // see https://jestjs.io/docs/en/expect#expecthasassertions
      67 |   // eslint-disable-next-line jest/no-standalone-expect
    > 68 |   expect.hasAssertions();
         |          ^
      69 |
      70 |   // Reset the mocked window.location. This ensures tests don't interfere with
      71 |   // each other, and removes the need to tidy up if it was changed for a given
      at Object.<anonymous> (spec/frontend/__helpers__/shared_test_setup.js:68:10)
  ● Timezone Dropdown › Initialize › with dropdown already loaded › when `allowEmpty` property is `false` › will default the timezone to UTC
    expect(received).toBe(expected) // Object.is equality
    Expected: "Etc/UTC"
    Received: undefined
      72 |           const tz = $inputEl.val();
      73 |
    > 74 |           expect(tz).toBe('Etc/UTC');
         |                      ^
      75 |         });
      76 |       });
      77 |
      at Object.<anonymous> (spec/frontend/pages/projects/pipeline_schedules/shared/components/timezone_dropdown_spec.js:74:22)
  ● Timezone Dropdown › Initialize › with dropdown already loaded › when `allowEmpty` property is `true` › will default the value of the input to an empty string
    expect(received).toBe(expected) // Object.is equality
    Expected: ""
    Received: undefined
      84 |
      85 |         it('will default the value of the input to an empty string', () => {
    > 86 |           expect($inputEl.val()).toBe('');
         |                                  ^
      87 |         });
      88 |       });
      89 |     });
      at Object.<anonymous> (spec/frontend/pages/projects/pipeline_schedules/shared/components/timezone_dropdown_spec.js:86:34)
  ● Timezone Dropdown › Initialize › without dropdown loaded › will populate the list of UTC offsets after the dropdown is loaded
    TypeError: Cannot read properties of undefined (reading 'length')
      102 |         initTimezoneDropdown();
      103 |
    > 104 |         expect($wrapper.find(tzListSel).length).toEqual($($dropdownEl).data('data').length);
          |                                                         ^
      105 |       });
      106 |
      107 |       it('will call a provided handler when a new timezone is selected', () => {
      at Object.<anonymous> (spec/frontend/pages/projects/pipeline_schedules/shared/components/timezone_dropdown_spec.js:104:57)
  ● Timezone Dropdown › Initialize › without dropdown loaded › will call a provided handler when a new timezone is selected
    expect(jest.fn()).toHaveBeenCalled()
    Expected number of calls: >= 1
    Received number of calls:    0
      112 |         $wrapper.find(tzListSel).first().trigger('click');
      113 |
    > 114 |         expect(onSelectTimezone).toHaveBeenCalled();
          |                                  ^
      115 |       });
      116 |
      117 |       it('will correctly set the dropdown label if a timezone identifier is set on the inputEl', () => {
      at Object.<anonymous> (spec/frontend/pages/projects/pipeline_schedules/shared/components/timezone_dropdown_spec.js:114:34)
  ● Timezone Dropdown › Initialize › without dropdown loaded › will correctly set the dropdown label if a timezone identifier is set on the inputEl
    expect(received).toEqual(expected) // deep equality
    Expected: "[UTC - 2.5] Newfoundland"
    Received: undefined
      120 |         initTimezoneDropdown({ displayFormat: (selectedItem) => formatTimezone(selectedItem) });
      121 |
    > 122 |         expect(findDropdownToggleText().html()).toEqual('[UTC - 2.5] Newfoundland');
          |                                                 ^
      123 |       });
      124 |
      125 |       it('will call a provided `displayFormat` handler to format the dropdown value', () => {
      at Object.<anonymous> (spec/frontend/pages/projects/pipeline_schedules/shared/components/timezone_dropdown_spec.js:122:49)
Test Suites: 1 failed, 675 passed, 676 total
Tests:       7 failed, 2 skipped, 17 todo, 9467 passed, 9493 total
Snapshots:   77 passed, 77 total
Time:        1191.177 s
Edited by Alina Mihaila