Fix unit tests for new login

Supply a server config to the component and adjust the wait logic to be less of a race. The Login component will noop onPasswordLogin if it is "busy", and it is busy when it requests the login flows.
This commit is contained in:
Travis Ralston 2019-05-03 16:27:41 -06:00
parent a5092dc763
commit fc5c93ab5f
2 changed files with 23 additions and 6 deletions

View file

@ -37,6 +37,8 @@ const ReactDOM = require('react-dom');
const ReactTestUtils = require('react-addons-test-utils');
const expect = require('expect');
import Promise from 'bluebird';
import {makeType} from "matrix-react-sdk/lib/utils/TypeUtils";
import {ValidatedServerConfig} from "matrix-react-sdk/lib/utils/AutoDiscoveryUtils";
const test_utils = require('../test-utils');
const MockHttpBackend = require('matrix-mock-request');
@ -97,17 +99,19 @@ describe('joining a room', function() {
PlatformPeg.set(new WebPlatform());
const config = {
validated_server_config: {
validated_server_config: makeType(ValidatedServerConfig, {
hsUrl: HS_URL,
hsName: "TEST_ENVIRONMENT",
hsNameIsDifferent: false, // yes, we lie
isUrl: IS_URL,
identityEnabled: true,
},
}),
};
const mc = (
<MatrixChat config={config}
<MatrixChat
config={config}
serverConfig={config.validated_server_config}
makeRegistrationUrl={()=>{throw new Error("unimplemented");}}
initialScreenAfterLogin={{
screen: 'directory',