From ae63df95ea09ec4be2f9a50bf4988ed4d98a16ef Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Thu, 2 May 2019 23:46:43 -0600 Subject: [PATCH] Fix tests to use new serverConfig prop --- test/components/structures/auth/Login-test.js | 4 ++-- test/components/structures/auth/Registration-test.js | 4 ++-- test/test-utils.js | 12 ++++++++++++ 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/test/components/structures/auth/Login-test.js b/test/components/structures/auth/Login-test.js index ec95243a56..74451b922f 100644 --- a/test/components/structures/auth/Login-test.js +++ b/test/components/structures/auth/Login-test.js @@ -22,6 +22,7 @@ import ReactTestUtils from 'react-dom/test-utils'; import sdk from 'matrix-react-sdk'; import SdkConfig from '../../../../src/SdkConfig'; import * as TestUtils from '../../../test-utils'; +import {mkServerConfig} from "../../../test-utils"; const Login = sdk.getComponent( 'structures.auth.Login', @@ -44,8 +45,7 @@ describe('Login', function() { function render() { return ReactDOM.render( {}} onRegisterClick={() => {}} onServerConfigChange={() => {}} diff --git a/test/components/structures/auth/Registration-test.js b/test/components/structures/auth/Registration-test.js index a10201d465..6914ed71d7 100644 --- a/test/components/structures/auth/Registration-test.js +++ b/test/components/structures/auth/Registration-test.js @@ -22,6 +22,7 @@ import ReactTestUtils from 'react-dom/test-utils'; import sdk from 'matrix-react-sdk'; import SdkConfig from '../../../../src/SdkConfig'; import * as TestUtils from '../../../test-utils'; +import {mkServerConfig} from "../../../test-utils"; const Registration = sdk.getComponent( 'structures.auth.Registration', @@ -44,8 +45,7 @@ describe('Registration', function() { function render() { return ReactDOM.render( {}} onLoggedIn={() => {}} onLoginClick={() => {}} diff --git a/test/test-utils.js b/test/test-utils.js index f4f00effbb..54705434e2 100644 --- a/test/test-utils.js +++ b/test/test-utils.js @@ -7,6 +7,8 @@ import PropTypes from 'prop-types'; import peg from '../src/MatrixClientPeg'; import dis from '../src/dispatcher'; import jssdk from 'matrix-js-sdk'; +import {makeType} from "../src/utils/TypeUtils"; +import {ValidatedServerConfig} from "../src/utils/AutoDiscoveryUtils"; const MatrixEvent = jssdk.MatrixEvent; /** @@ -260,6 +262,16 @@ export function mkStubRoom(roomId = null) { }; } +export function mkServerConfig(hsUrl, isUrl) { + return makeType(ValidatedServerConfig, { + hsUrl, + hsName: "TEST_ENVIRONMENT", + hsNameIsDifferent: false, // yes, we lie + isUrl, + identityEnabled: true, + }); +} + export function getDispatchForStore(store) { // Mock the dispatcher by gut-wrenching. Stores can only __emitChange whilst a // dispatcher `_isDispatching` is true.