You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by jd...@apache.org on 2020/07/27 15:32:18 UTC
[qpid-dispatch] branch master updated: DISPATCH-1725 Fix some Jest
Web Console unittests (#783)
This is an automated email from the ASF dual-hosted git repository.
jdanek pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-dispatch.git
The following commit(s) were added to refs/heads/master by this push:
new 301eee1 DISPATCH-1725 Fix some Jest Web Console unittests (#783)
301eee1 is described below
commit 301eee1400470032f904c1401770fbd440aabe0c
Author: Jiri Daněk <jd...@redhat.com>
AuthorDate: Mon Jul 27 17:32:08 2020 +0200
DISPATCH-1725 Fix some Jest Web Console unittests (#783)
---
console/react/package.json | 1 +
console/react/src/details/detailsTablePage.js | 6 +++---
console/react/src/details/detailsTablePage.test.js | 3 ++-
console/react/test_data/qdrService.mock.js | 12 +++++-------
4 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/console/react/package.json b/console/react/package.json
index 4109e4f..8b86b52 100644
--- a/console/react/package.json
+++ b/console/react/package.json
@@ -48,6 +48,7 @@
"@react-mock/localstorage": "^0.1.2",
"@testing-library/jest-dom": "^4.2.3",
"@testing-library/react": "^9.3.2",
+ "@types/jest": "^24.9.0",
"body-parser": "^1.19.0",
"browserslist": "^4.7.3",
"jest-axe": "^3.2.0",
diff --git a/console/react/src/details/detailsTablePage.js b/console/react/src/details/detailsTablePage.js
index ce61093..298f031 100644
--- a/console/react/src/details/detailsTablePage.js
+++ b/console/react/src/details/detailsTablePage.js
@@ -42,7 +42,7 @@ import { dataMap } from "../overview/entityData";
import { dataMap as detailsDataMap, defaultData } from "./entityData";
import Updated from "../common/updated";
-class DetailTablesPage extends React.Component {
+class DetailsTablePage extends React.Component {
constructor(props) {
super(props);
this.state = {
@@ -58,7 +58,7 @@ class DetailTablesPage extends React.Component {
redirect: false,
redirectState: { page: 1 },
redirectPath: "/dashboard",
- lastUpdated: new Date()
+ lastUpdated: new Date(),
};
// if we get to this page and we don't have a props.location.state.entity
// then redirect back to the dashboard.
@@ -239,4 +239,4 @@ class DetailTablesPage extends React.Component {
}
}
-export default DetailTablesPage;
+export default DetailsTablePage;
diff --git a/console/react/src/details/detailsTablePage.test.js b/console/react/src/details/detailsTablePage.test.js
index a374e97..1eaf1cd 100644
--- a/console/react/src/details/detailsTablePage.test.js
+++ b/console/react/src/details/detailsTablePage.test.js
@@ -39,7 +39,8 @@ it("renders the DetailTablesPage", () => {
},
details: true,
service,
- schema: service.schema
+ schema: service.schema,
+ lastUpdated: (date) => {},
};
const { getByTestId } = render(<DetailTablesPage {...props} />);
diff --git a/console/react/test_data/qdrService.mock.js b/console/react/test_data/qdrService.mock.js
index 6c6840d..f9bb00b 100644
--- a/console/react/test_data/qdrService.mock.js
+++ b/console/react/test_data/qdrService.mock.js
@@ -37,19 +37,21 @@ export const mockService = ({ onSendMethod }) => {
const cbSendMethod = onSendMethod ? onSendMethod : () => {};
return {
management: {
+ schema: () => schema,
connection: {
sendMethod: () => {
cbSendMethod();
return Promise.resolve(methodResults);
},
is_connected: () => true,
- setReconnect: () => {}
+ setReconnect: () => {},
+ getReceiverAddress: () => 'amqp:/_topo/0/routerName/',
},
topology: {
setUpdateEntities: () => {},
ensureAllEntities: (stuff, cb) => cb(),
ensureEntities: (foo, bar, cb) => cb(foo, fetchResults),
- startUpdating: () => {},
+ startUpdating: () => new Promise(resolve => resolve()),
stopUpdating: () => {},
addChangedAction: () => {},
delChangedAction: () => {},
@@ -60,17 +62,13 @@ export const mockService = ({ onSendMethod }) => {
resolve();
});
},
- startUpdating: () => {
- return new Promise(resolve => {
- resolve();
- });
- },
edgesPerRouter: () => {},
edgeList: [],
nodeIdList: () => [],
fetchAllEntities: (stuff, cb) => {
cb(fetchResults);
},
+ fetchEntity: (node, entity, attrs, cb) => cb(node, entity, {results: []}),
fetchEntities: (foo, bar, cb) => cb(fetchResults),
nodeInfo: () => nodeInfo,
_nodeInfo: nodeInfo
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org