Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

306
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda