Skip to content

Commit

Permalink
upgrade react-router-dom dependency (#18762)
Browse files Browse the repository at this point in the history
* upgrade react-router-dom dependency

* Fix unit tests that rely on push to same path

Co-authored-by: Jeff Balboni <jeff@adhocteam.us>
  • Loading branch information
jhonnyoddball and jbalboni committed Sep 17, 2021
1 parent a5759c9 commit 85430f8
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 22 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -288,7 +288,7 @@
"react-meta-tags": "^0.7.4",
"react-redux": "^7.2.5",
"react-router": "3",
"react-router-dom": "^5.2.0",
"react-router-dom": "^5.3.0",
"react-router-last-location": "^2.0.1",
"react-scroll": "^1.8.4",
"react-tabs": "^3.2.2",
Expand Down
@@ -1,4 +1,3 @@
import userEvent from '@testing-library/user-event';
import { waitFor } from '@testing-library/dom';
import { expect } from 'chai';
import moment from 'moment';
Expand Down Expand Up @@ -85,9 +84,10 @@ describe('VAOS vaccine flow <ConfirmationPage>', () => {
expect(screen.baseElement).to.contain.text('Main phone: 307-778-7580');
expect(screen.getByText(/add to calendar/i)).to.have.tagName('a');

userEvent.click(screen.getByText(/View your appointments/i));
expect(screen.history.push.called).to.be.true;
expect(screen.history.push.getCall(0).args[0]).to.equal('/');
expect(screen.getByText(/View your appointments/i)).to.have.attribute(
'href',
'/',
);
});

it('should redirect to home page if no form data', async () => {
Expand Down
Expand Up @@ -102,10 +102,10 @@ describe('VAOS vaccine flow <ConfirmationPageV2>', () => {
),
).to.be.ok;
userEvent.click(screen.getByText(/View your appointments/i));
expect(screen.history.push.called).to.be.true;
expect(screen.history.push.getCall(0).args[0]).to.equal('/');
expect(screen.history.replace.called).to.be.true;
expect(screen.history.replace.firstCall.args[0]).to.equal('/');
userEvent.click(screen.getByText(/New appointment/i));
expect(screen.history.push.getCall(1).args[0]).to.equal('/new-appointment');
expect(screen.history.push.firstCall.args[0]).to.equal('/new-appointment');
});

it('should redirect to home page if no form data', async () => {
Expand Down
Expand Up @@ -121,9 +121,10 @@ describe('VAOS <ConfirmationDirectScheduleInfoV2>', () => {

it('should render appointment list page when "View your appointments" link is clicked', () => {
const screen = renderWithStoreAndRouter(<ConfirmationPage />, { store });
userEvent.click(screen.getByText(/View your appointments/i));
expect(screen.history.push.called).to.be.true;
expect(screen.history.push.getCall(0).args[0]).to.equal('/');
expect(screen.getByText(/View your appointments/i)).to.have.attribute(
'href',
'/',
);
});

it('should render new appointment page when "New appointment" link is clicked', () => {
Expand Down
22 changes: 11 additions & 11 deletions yarn.lock
Expand Up @@ -15419,16 +15419,16 @@ react-remove-scroll@^2.4.1:
use-callback-ref "^1.2.3"
use-sidecar "^1.0.1"

react-router-dom@^5.2.0:
version "5.2.0"
resolved "https://registry.npmjs.org/react-router-dom/-/react-router-dom-5.2.0.tgz"
integrity sha512-gxAmfylo2QUjcwxI63RhQ5G85Qqt4voZpUXSEqCwykV0baaOTQDR1f0PmY8AELqIyVc0NEZUj0Gov5lNGcXgsA==
react-router-dom@^5.3.0:
version "5.3.0"
resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-5.3.0.tgz#da1bfb535a0e89a712a93b97dd76f47ad1f32363"
integrity sha512-ObVBLjUZsphUUMVycibxgMdh5jJ1e3o+KpAZBVeHcNQZ4W+uUGGWsokurzlF4YOldQYRQL4y6yFRWM4m3svmuQ==
dependencies:
"@babel/runtime" "^7.1.2"
"@babel/runtime" "^7.12.13"
history "^4.9.0"
loose-envify "^1.3.1"
prop-types "^15.6.2"
react-router "5.2.0"
react-router "5.2.1"
tiny-invariant "^1.0.2"
tiny-warning "^1.0.0"

Expand All @@ -15451,12 +15451,12 @@ react-router@3:
react-is "^16.13.0"
warning "^3.0.0"

react-router@5.2.0:
version "5.2.0"
resolved "https://registry.npmjs.org/react-router/-/react-router-5.2.0.tgz"
integrity sha512-smz1DUuFHRKdcJC0jobGo8cVbhO3x50tCL4icacOlcwDOEQPq4TMqwx3sY1TP+DvtTgz4nm3thuo7A+BK2U0Dw==
react-router@5.2.1:
version "5.2.1"
resolved "https://registry.yarnpkg.com/react-router/-/react-router-5.2.1.tgz#4d2e4e9d5ae9425091845b8dbc6d9d276239774d"
integrity sha512-lIboRiOtDLFdg1VTemMwud9vRVuOCZmUIT/7lUoZiSpPODiiH1UQlfXy+vPLC/7IWdFYnhRwAyNqA/+I7wnvKQ==
dependencies:
"@babel/runtime" "^7.1.2"
"@babel/runtime" "^7.12.13"
history "^4.9.0"
hoist-non-react-statics "^3.1.0"
loose-envify "^1.3.1"
Expand Down

0 comments on commit 85430f8

Please sign in to comment.