Use the new ShallowRenderer over ReactTestUtils

Mostly because the ReactTestUtils renderer doesn't exist anymore.
This commit is contained in:
Travis Ralston 2019-09-17 14:33:32 -06:00
parent acf474c402
commit 99b8193ce7
4 changed files with 23 additions and 2 deletions

View File

@ -150,6 +150,7 @@
"matrix-mock-request": "^1.2.3",
"matrix-react-test-utils": "^0.2.2",
"mocha": "^5.0.5",
"react-test-renderer": "^16.9.0",
"require-json": "0.0.1",
"rimraf": "^2.4.3",
"sinon": "^5.0.7",

View File

@ -112,7 +112,7 @@ describe('MemberEventListSummary', function() {
threshold: 3,
};
const renderer = ReactTestUtils.createRenderer();
const renderer = testUtils.getRenderer();
renderer.render(<MemberEventListSummary {...props} />);
const result = renderer.getRenderOutput();
@ -134,7 +134,7 @@ describe('MemberEventListSummary', function() {
threshold: 3,
};
const renderer = ReactTestUtils.createRenderer();
const renderer = testUtils.getRenderer();
renderer.render(<MemberEventListSummary {...props} />);
const result = renderer.getRenderOutput();

View File

@ -9,6 +9,7 @@ import dis from '../src/dispatcher';
import jssdk from 'matrix-js-sdk';
import {makeType} from "../src/utils/TypeUtils";
import {ValidatedServerConfig} from "../src/utils/AutoDiscoveryUtils";
import ShallowRenderer from 'react-test-renderer/shallow';
const MatrixEvent = jssdk.MatrixEvent;
/**
@ -31,6 +32,10 @@ export function beforeEach(context) {
console.log(new Array(1 + desc.length).join("="));
}
export function getRenderer() {
// Old: ReactTestUtils.createRenderer();
return new ShallowRenderer();
}
/**
* Stub out the MatrixClient, and configure the MatrixClientPeg object to

View File

@ -6404,6 +6404,11 @@ react-is@^16.6.0, react-is@^16.7.0, react-is@^16.8.1, react-is@^16.8.4:
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.8.6.tgz#5bbc1e2d29141c9fbdfed456343fe2bc430a6a16"
integrity sha512-aUk3bHfZ2bRSVFFbbeVS4i+lNPZr3/WM5jT2J5omUVV1zzcs1nAaf3l51ctA5FFvCRbhrH0bdAsRRQddFJZPtA==
react-is@^16.9.0:
version "16.9.0"
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.9.0.tgz#21ca9561399aad0ff1a7701c01683e8ca981edcb"
integrity sha512-tJBzzzIgnnRfEm046qRcURvwQnZVXmuCbscxUO5RWrGTXpon2d4c8mI0D8WE6ydVIm29JiLB6+RslkIvym9Rjw==
react-lifecycles-compat@^3.0.0:
version "3.0.4"
resolved "https://registry.yarnpkg.com/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz#4f1a273afdfc8f3488a8c516bfda78f872352362"
@ -6431,6 +6436,16 @@ react-redux@^5.0.6:
react-is "^16.6.0"
react-lifecycles-compat "^3.0.0"
react-test-renderer@^16.9.0:
version "16.9.0"
resolved "https://registry.yarnpkg.com/react-test-renderer/-/react-test-renderer-16.9.0.tgz#7ed657a374af47af88f66f33a3ef99c9610c8ae9"
integrity sha512-R62stB73qZyhrJo7wmCW9jgl/07ai+YzvouvCXIJLBkRlRqLx4j9RqcLEAfNfU3OxTGucqR2Whmn3/Aad6L3hQ==
dependencies:
object-assign "^4.1.1"
prop-types "^15.6.2"
react-is "^16.9.0"
scheduler "^0.15.0"
react-transition-group@^1.2.0:
version "1.2.1"
resolved "https://registry.yarnpkg.com/react-transition-group/-/react-transition-group-1.2.1.tgz#e11f72b257f921b213229a774df46612346c7ca6"