You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-07-31 13:44:28 +03:00
Step 3.1: Stop using getComponent
in tests
This commit is contained in:
@ -20,9 +20,10 @@ import ReactTestUtils from 'react-dom/test-utils';
|
||||
import { mocked } from 'jest-mock';
|
||||
import { createClient, MatrixClient } from "matrix-js-sdk/src/matrix";
|
||||
|
||||
import sdk from '../../../skinned-sdk';
|
||||
import SdkConfig from '../../../../src/SdkConfig';
|
||||
import { mkServerConfig } from "../../../test-utils";
|
||||
import Login from "../../../../src/components/structures/auth/Login";
|
||||
import PasswordLogin from "../../../../src/components/views/auth/PasswordLogin";
|
||||
|
||||
jest.mock("matrix-js-sdk/src/matrix");
|
||||
|
||||
@ -30,10 +31,6 @@ const flushPromises = async () => await new Promise(process.nextTick);
|
||||
|
||||
jest.useRealTimers();
|
||||
|
||||
const Login = sdk.getComponent(
|
||||
'structures.auth.Login',
|
||||
);
|
||||
|
||||
describe('Login', function() {
|
||||
let parentDiv;
|
||||
const mockClient = mocked({
|
||||
@ -80,7 +77,7 @@ describe('Login', function() {
|
||||
|
||||
const form = ReactTestUtils.findRenderedComponentWithType(
|
||||
root,
|
||||
sdk.getComponent('auth.PasswordLogin'),
|
||||
PasswordLogin,
|
||||
);
|
||||
expect(form).toBeTruthy();
|
||||
|
||||
@ -94,7 +91,7 @@ describe('Login', function() {
|
||||
|
||||
const form = ReactTestUtils.findRenderedComponentWithType(
|
||||
root,
|
||||
sdk.getComponent('auth.PasswordLogin'),
|
||||
PasswordLogin,
|
||||
);
|
||||
expect(form).toBeTruthy();
|
||||
|
||||
@ -118,7 +115,7 @@ describe('Login', function() {
|
||||
const root = render();
|
||||
await flushPromises();
|
||||
|
||||
const form = ReactTestUtils.findRenderedComponentWithType(root, sdk.getComponent('auth.PasswordLogin'));
|
||||
const form = ReactTestUtils.findRenderedComponentWithType(root, PasswordLogin);
|
||||
expect(form).toBeTruthy();
|
||||
|
||||
const ssoButton = ReactTestUtils.findRenderedDOMComponentWithClass(root, "mx_SSOButton");
|
||||
|
@ -19,17 +19,14 @@ import ReactDOM from 'react-dom';
|
||||
import ReactTestUtils from 'react-dom/test-utils';
|
||||
import { createClient } from 'matrix-js-sdk/src/matrix';
|
||||
|
||||
import sdk from '../../../skinned-sdk';
|
||||
import SdkConfig, { DEFAULTS } from '../../../../src/SdkConfig';
|
||||
import { createTestClient, mkServerConfig } from "../../../test-utils";
|
||||
import Registration from "../../../../src/components/structures/auth/Registration";
|
||||
import RegistrationForm from "../../../../src/components/views/auth/RegistrationForm";
|
||||
|
||||
jest.mock('matrix-js-sdk/src/matrix');
|
||||
jest.useFakeTimers();
|
||||
|
||||
const Registration = sdk.getComponent(
|
||||
'structures.auth.Registration',
|
||||
);
|
||||
|
||||
describe('Registration', function() {
|
||||
let parentDiv;
|
||||
|
||||
@ -79,7 +76,7 @@ describe('Registration', function() {
|
||||
|
||||
const form = ReactTestUtils.findRenderedComponentWithType(
|
||||
root,
|
||||
sdk.getComponent('auth.RegistrationForm'),
|
||||
RegistrationForm,
|
||||
);
|
||||
expect(form).toBeTruthy();
|
||||
});
|
||||
|
Reference in New Issue
Block a user