summaryrefslogtreecommitdiff
path: root/web/src/containers/status
diff options
context:
space:
mode:
authorJames E. Blair <jim@acmegating.com>2021-11-06 16:05:44 -0700
committerMatthieu Huin <mhuin@redhat.com>2021-11-18 16:39:17 +0100
commit59af3e2c17a7b7996ead2e72b1b665170714a8ef (patch)
tree7f160d047ed21faf2b23643da5b4d2e56ca66312 /web/src/containers/status
parenta7423a4e2b900ad5ba5ea9134d70eab729469419 (diff)
downloadzuul-59af3e2c17a7b7996ead2e72b1b665170714a8ef.tar.gz
Upgrade react-router-dom
This updates react-router-dom to not quite the latest version, but a new enough version that it supports hooks. This also changes how React Refs are handled in such a way that it breaks some tests which rely on on reaching through the redux store into child nodes. To resolve this, some tests are updated to use the react-test-renderer instead. The tests in App.test.jsx were not asserting anything past the initial toEqual assertion in the path, which is why they are only now being updated to match links added since the test inception. Change-Id: Ia80fbfe3cf2d2d275fd8422111ec193c467bf606
Diffstat (limited to 'web/src/containers/status')
-rw-r--r--web/src/containers/status/ChangePanel.test.jsx27
1 files changed, 13 insertions, 14 deletions
diff --git a/web/src/containers/status/ChangePanel.test.jsx b/web/src/containers/status/ChangePanel.test.jsx
index 76a3051f8..5a4be8602 100644
--- a/web/src/containers/status/ChangePanel.test.jsx
+++ b/web/src/containers/status/ChangePanel.test.jsx
@@ -13,9 +13,9 @@
// under the License.
import React from 'react'
-import ReactTestUtils from 'react-dom/test-utils'
import { Link, BrowserRouter as Router } from 'react-router-dom'
import { Provider } from 'react-redux'
+import { create } from 'react-test-renderer'
import { setTenantAction } from '../../actions/tenant'
import configureStore from '../../store'
@@ -31,34 +31,33 @@ const fakeChange = {
}]
}
-const store = configureStore()
it('change panel render multi tenant links', () => {
+ const store = configureStore()
store.dispatch(setTenantAction('tenant-one', false))
- const application = ReactTestUtils.renderIntoDocument(
- <Provider store={store}>
- <Router>
- <ChangePanel change={fakeChange} globalExpanded={true} />
- </Router>
- </Provider>
- )
- const jobLink = ReactTestUtils.findRenderedComponentWithType(
- application, Link)
+ const application = create(
+ <Provider store={store}>
+ <Router>
+ <ChangePanel change={fakeChange} globalExpanded={true} />
+ </Router>
+ </Provider>
+ )
+ const jobLink = application.root.findByType(Link)
expect(jobLink.props.to).toEqual(
'/t/tenant-one/stream/42')
})
it('change panel render white-label tenant links', () => {
+ const store = configureStore()
store.dispatch(setTenantAction('tenant-one', true))
- const application = ReactTestUtils.renderIntoDocument(
+ const application = create(
<Provider store={store}>
<Router>
<ChangePanel change={fakeChange} globalExpanded={true} />
</Router>
</Provider>
)
- const jobLink = ReactTestUtils.findRenderedComponentWithType(
- application, Link)
+ const jobLink = application.root.findByType(Link)
expect(jobLink.props.to).toEqual(
'/stream/42')
})