Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

308
Views
Jest Error: Uncaught Invariant Violation: A state mutation was detected between dispatches, in the path

I am trying to run a existing jest test after I made momentTimezone change in the code. I believe it's because my change does another state change between the redux dispatch in the test case. I am not sure how to fix it. The expected value is appointmentGroupState.isBookingLocked is false instead of true along with this error - Below is the jest code where the error is been thrown:

Uncaught [Invariant Violation: A state mutation was detected between dispatches, in the path suggestionSearchCriteria.beginDate._locale._longDateFormat.l.

      const recurViewPresenterComponentState = wrapper
        .find('RecurViewPresenter')
        .prop('recurViewPresenterComponentState');
      const appointmentGroupState = recurViewPresenterComponentState.recurUIAppointmentGroupStates.find(
        ({ id }) => id === MockRecurUIComponentConfigurationMultipleApptGroups.appointmentGroups[0].uuid,
      );
      **expect(appointmentGroupState.isBookingLocked).toBe(true);**
    });

Here is my main code snippet - momentTimezone(patientDurationDisplay.beginDateTime); I just added momentTimezone and the jest is failing.

Here is the full dispatch

    const clickAppointmentTypeCard = (wrapper, apptTypeCardIndex) => {
      wrapper.find('.single-appointment-type-card-list > *').at(apptTypeCardIndex).simulate('click');
    };
    let wrapper;

    window.featureToggles = {
      getAllEnabledToggles: () => [],
    };

    beforeEach(() => {
      wrapper = mountWithTestFileI18N(
        <RecurViewPresenter
          recurUIComponentConfiguration={
            new RecurUIComponentConfiguration({
              ...MockRecurUIComponentConfigurationMultipleApptGroups,
              appointmentGroups: [
                {
                  ...MockRecurUIComponentConfigurationMultipleApptGroups.appointmentGroups[0],
                  appointmentGroupConfiguration: {
                    ...MockRecurUIComponentConfigurationMultipleApptGroups.appointmentGroups[0]
                      .appointmentGroupConfiguration,
                    multipleAppointmentInstancesConfiguration: {
                      numberOfAppointmentInstancesInADay: 1,
                      hoursBetweenAppointmentInstancesInADay: 0,
                    },
                  },
                },
                MockRecurUIComponentConfigurationMultipleApptGroups.appointmentGroups[1],
              ],
            })
          }
          retrieveRecurringAppointmentSuggestions={() => createMockAppointmentGroupSuggestionResult()}
          onSuggestionsSelected={() => ({
            bookingStatus: 'SUCCESS',
            lockReleaseStatus: 'SUCCESS',
          })}
        />,
      );
      
    afterEach(() => {
      mockSuggestionResultsComponentSelection = {
        ...mockSuggestionResultsComponentSelection,
        instanceIndex: 1,
      };
    });
    ```

 
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!