30 test failures to go :D

This commit is contained in:
Michael Telatynski 2019-12-16 11:12:48 +00:00
parent ffa2ac172c
commit 6ad31fe023
33 changed files with 424 additions and 709 deletions

View file

@ -17,14 +17,13 @@ limitations under the License.
import React from 'react';
import ReactDOM from 'react-dom';
import ReactTestUtils from 'react-dom/test-utils';
import expect from 'expect';
import MockHttpBackend from 'matrix-mock-request';
import MatrixClientPeg from '../../../src/MatrixClientPeg';
import sdk from 'matrix-react-sdk';
import sdk from '../../skinned-sdk';
import Matrix from 'matrix-js-sdk';
import * as TestUtils from 'test-utils';
import * as TestUtils from '../../test-utils';
const { waitForUpdate } = TestUtils;
const GroupView = sdk.getComponent('structures.GroupView');

View file

@ -23,10 +23,9 @@ import ReactDOM from "react-dom";
import PropTypes from "prop-types";
const TestUtils = require('react-dom/test-utils');
const expect = require('expect');
import sinon from 'sinon';
import { EventEmitter } from "events";
const sdk = require('matrix-react-sdk');
import sdk from '../../skinned-sdk';
const MessagePanel = sdk.getComponent('structures.MessagePanel');
import MatrixClientPeg from '../../../src/MatrixClientPeg';
@ -72,15 +71,14 @@ describe('MessagePanel', function() {
const clock = mockclock.clock();
const realSetTimeout = window.setTimeout;
const events = mkEvents();
let sandbox = null;
beforeEach(function() {
sandbox = test_utils.stubClient();
test_utils.stubClient();
client = MatrixClientPeg.get();
client.credentials = {userId: '@me:here'};
// HACK: We assume all settings want to be disabled
SettingsStore.getValue = sinon.stub().returns(false);
SettingsStore.getValue = jest.fn().returns(false);
SettingsStore.getValue.withArgs('showDisplaynameChanges').returns(true);
// This option clobbers the duration of all animations to be 1ms
@ -94,7 +92,6 @@ describe('MessagePanel', function() {
delete Velocity.mock;
clock.uninstall();
sandbox.restore();
});
function mkEvents() {

View file

@ -14,12 +14,10 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import expect from 'expect';
import sinon from 'sinon';
import React from 'react';
import ReactDOM from 'react-dom';
import ReactTestUtils from 'react-dom/test-utils';
import sdk from 'matrix-react-sdk';
import sdk from '../../../skinned-sdk';
import SdkConfig from '../../../../src/SdkConfig';
import {mkServerConfig} from "../../../test-utils";
@ -36,7 +34,6 @@ describe('Login', function() {
});
afterEach(function() {
sinon.restore();
ReactDOM.unmountComponentAtNode(parentDiv);
parentDiv.remove();
});
@ -72,7 +69,7 @@ describe('Login', function() {
});
it('should show form without change server link when custom URLs disabled', function() {
sinon.stub(SdkConfig, "get").returns({
jest.spyOn(SdkConfig, "get").returns({
disable_custom_urls: true,
});

View file

@ -14,12 +14,10 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import expect from 'expect';
import sinon from 'sinon';
import React from 'react';
import ReactDOM from 'react-dom';
import ReactTestUtils from 'react-dom/test-utils';
import sdk from 'matrix-react-sdk';
import sdk from '../../../skinned-sdk';
import SdkConfig from '../../../../src/SdkConfig';
import {mkServerConfig} from "../../../test-utils";
@ -36,7 +34,6 @@ describe('Registration', function() {
});
afterEach(function() {
sinon.restore();
ReactDOM.unmountComponentAtNode(parentDiv);
parentDiv.remove();
});
@ -61,7 +58,7 @@ describe('Registration', function() {
});
it('should show form when custom URLs disabled', function() {
sinon.stub(SdkConfig, "get").returns({
jest.spyOn(SdkConfig, "get").returns({
disable_custom_urls: true,
});