PublicDataWorks / complaint-manager

Apache License 2.0
4 stars 0 forks source link

Upgrade to React 17 #607

Open claireholt-tw opened 2 months ago

claireholt-tw commented 2 months ago

User Story

As a developer I want to upgrade complaint manager to React 17 So that I can use new tools and libraries like MUI X Data Grid.

Context

As a result of the conclusion drawn from this spike, we need to upgrade to React 17. In order to do this, we'll need to update the following:

We know this change will cause a handful of tests to fail (about 9), and we will need to investigate & fix those tests. A few of the failing tests are associated with the RichTextEditor component, and we suspect that React Quill is the problem & might need updating.

For more details, see the comment section of the spike linked above.

Definition of Done

Complaint manager uses React 17 across the app with no failing tests or breaking changes.

Acceptance Criteria

Given complaint manager upgrades to React 17 When I rebuild and run all tests Then the app works, the build works, and no tests fail.

rd-huerta commented 2 months ago

test-output.txt

paul-thompson1 commented 2 months ago

I managed to update the following packages:

Note: We are still updating packages

The following are detected warnings when using the app:

I was able to build and run the app: (react version in console) Screenshot 2024-05-02 at 5 56 39 PM REACT-17

paul-thompson1 commented 2 months ago

We have 33 tests failing so far.

Image

Potential reasons for failing tests:

paul-thompson1 commented 2 months ago

The tests that are failing are problematic in the way they were originally written. Here's an example test from EditReferralLetter.test.js

test("open cancel dialog and not save edits when clicking logout", () => {
    history.push("/logout");

    expect(wrapper.find("[data-testid='dialog-cancel-button']")).toHaveLength(
      0
    );

    expect(dispatchSpy).not.toHaveBeenCalledWith(editReferralLetterContent());

    const input = wrapper.find("Quill").first();
    input.props().onChange("testing");

    history.push("/logout");
    wrapper.update();

    const cancelEditLetterDialog = wrapper
      .find("[data-testid='dialog-cancel-button']")
      .first();
    expect(cancelEditLetterDialog.length).toEqual(1);
  });
CwoodsTW commented 1 month ago

Currently stuck on this output in the OfficerHistories.Test file. Andrew alluded to enzyme not caring about mocked components returning nothing. RTL may be stricter. Tried updating the component with some conditional logic to return null but it still failed.

Image