Fix more tests

pull/21833/head
Michael Telatynski 2019-12-17 11:47:01 +00:00
parent ab3fb6581b
commit e6d8487302
11 changed files with 42 additions and 884 deletions

View File

@ -20,7 +20,6 @@
"git-revision.txt",
"header",
"jenkins.sh",
"karma.conf.js",
"lib",
"package.json",
"release.sh",
@ -143,18 +142,8 @@
"file-loader": "^3.0.1",
"flow-parser": "^0.57.3",
"jest": "^23.2.0",
"karma": "^4.0.1",
"karma-chrome-launcher": "^2.2.0",
"karma-cli": "^1.0.1",
"karma-logcapture-reporter": "0.0.1",
"karma-mocha": "^1.3.0",
"karma-sourcemap-loader": "^0.3.7",
"karma-spec-reporter": "^0.0.31",
"karma-summary-reporter": "^1.5.1",
"karma-webpack": "^4.0.0-beta.0",
"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",
@ -168,6 +157,7 @@
"webpack-cli": "^3.1.1"
},
"jest": {
"setupTestFrameworkScriptFile": "<rootDir>/test/setupTests.js",
"moduleNameMapper": {
"\\.(gif|png|svg|ttf|woff2)$": "<rootDir>/__mocks__/imageMock.js"
}

View File

@ -21,7 +21,7 @@ import sdk from '../../../index';
import MatrixClientPeg from '../../../MatrixClientPeg';
import { _t } from '../../../languageHandler';
import Modal from '../../../Modal';
import SettingsStore from '../../../../lib/settings/SettingsStore';
import SettingsStore from '../../../settings/SettingsStore';
import { accessSecretStorage } from '../../../CrossSigningManager';
export default class KeyBackupPanel extends React.PureComponent {

View File

@ -84,13 +84,8 @@ describe('MemberEventListSummary', function() {
return eventsForUsers;
};
beforeEach(function(done) {
beforeEach(function() {
testUtils.stubClient();
languageHandler.setLanguage('en').then(done);
languageHandler.setMissingEntryGenerator(function(key) {
return key.split('|', 2)[1];
});
});
it('renders expanded events if there are less than props.threshold', function() {

View File

@ -24,6 +24,7 @@ import sdk from "../../../skinned-sdk";
import Matrix from "matrix-js-sdk";
import * as TestUtils from "../../../test-utils";
import * as languageHandler from "../../../../src/languageHandler";
const { waitForUpdate } = TestUtils;
const GroupMemberList = sdk.getComponent("views.groups.GroupMemberList");

View File

@ -5,7 +5,7 @@ import lolex from 'lolex';
import * as TestUtils from '../../../test-utils';
import sdk from '../../../../src/index';
import sdk from '../../../skinned-sdk';
import MatrixClientPeg from '../../../../src/MatrixClientPeg';
import {Room, RoomMember, User} from 'matrix-js-sdk';

View File

@ -5,7 +5,7 @@ import lolex from 'lolex';
import * as TestUtils from '../../../test-utils';
import sdk from '../../../../src/index';
import sdk from '../../../skinned-sdk';
import MatrixClientPeg from '../../../../src/MatrixClientPeg';
import { DragDropContext } from 'react-beautiful-dnd';
@ -177,7 +177,7 @@ describe('RoomList', () => {
function itDoesCorrectOptimisticUpdatesForDraggedRoomTiles() {
// TODO: Re-enable dragging tests when we support dragging again.
xdescribe('does correct optimistic update when dragging from', () => {
describe.skip('does correct optimistic update when dragging from', () => {
it('rooms to people', () => {
expectCorrectMove(undefined, 'im.vector.fake.direct');
});

View File

@ -4,12 +4,13 @@ import ReactDOM from 'react-dom';
import jest from 'jest-mock';
import * as testUtils from '../../../test-utils';
import sdk from '../../../skinned-sdk';
const WrappedRoomSettings = testUtils.wrapInMatrixClientContext(sdk.getComponent('views.rooms.RoomSettings'));
import MatrixClientPeg from '../../../../src/MatrixClientPeg';
import SettingsStore from '../../../../src/settings/SettingsStore';
describe.skip('RoomSettings', () => {
const WrappedRoomSettings = testUtils.wrapInMatrixClientContext(sdk.getComponent('views.rooms.RoomSettings'));
let parentDiv = null;
let client = null;
let roomSettings = null;

View File

@ -9,9 +9,7 @@ describe('languageHandler', function() {
testUtils.stubClient();
languageHandler.setLanguage('en').then(done);
languageHandler.setMissingEntryGenerator(function(key) {
return key.split('|', 2)[1];
});
languageHandler.setMissingEntryGenerator(key => key.split("|", 2)[1]);
});
it('translates a string to german', function() {

4
test/setupTests.js Normal file
View File

@ -0,0 +1,4 @@
import * as languageHandler from "../src/languageHandler";
languageHandler.setLanguage('en');
languageHandler.setMissingEntryGenerator(key => key.split("|", 2)[1]);

View File

@ -16,7 +16,7 @@ describe('RoomViewStore', function() {
});
it('can be used to view a room by ID and join', function(done) {
peg.get().joinRoom = (roomAddress) => {
peg.get().joinRoom = async (roomAddress) => {
expect(roomAddress).toBe("!randomcharacters:aser.ver");
done();
};
@ -28,7 +28,7 @@ describe('RoomViewStore', function() {
it('can be used to view a room by alias and join', function(done) {
peg.get().getRoomIdForAlias.mockResolvedValue({room_id: "!randomcharacters:aser.ver"});
peg.get().joinRoom = (roomAddress) => {
peg.get().joinRoom = async (roomAddress) => {
expect(roomAddress).toBe("#somealias2:aser.ver");
done();
};

883
yarn.lock

File diff suppressed because it is too large Load Diff