Step 3.1: Stop using getComponent in tests
This commit is contained in:
@@ -18,17 +18,15 @@ import React from "react";
|
||||
import { mount } from "enzyme";
|
||||
import { mocked } from "jest-mock";
|
||||
|
||||
import sdk from "../../../skinned-sdk";
|
||||
import { formatFullDateNoTime } from "../../../../src/DateUtils";
|
||||
import SettingsStore from "../../../../src/settings/SettingsStore";
|
||||
import { UIFeature } from "../../../../src/settings/UIFeature";
|
||||
import MatrixClientContext from "../../../../src/contexts/MatrixClientContext";
|
||||
import { getMockClientWithEventEmitter } from "../../../test-utils";
|
||||
import DateSeparator from "../../../../src/components/views/messages/DateSeparator";
|
||||
|
||||
jest.mock("../../../../src/settings/SettingsStore");
|
||||
|
||||
const DateSeparator = sdk.getComponent("views.messages.DateSeparator");
|
||||
|
||||
describe("DateSeparator", () => {
|
||||
const HOUR_MS = 3600000;
|
||||
const DAY_MS = HOUR_MS * 24;
|
||||
|
||||
@@ -29,7 +29,6 @@ import { TEXT_NODE_TYPE } from "matrix-js-sdk/src/@types/extensible_events";
|
||||
import maplibregl from 'maplibre-gl';
|
||||
import { logger } from 'matrix-js-sdk/src/logger';
|
||||
|
||||
import sdk from "../../../skinned-sdk";
|
||||
import MLocationBody, {
|
||||
isSelfLocation,
|
||||
} from "../../../../src/components/views/messages/MLocationBody";
|
||||
@@ -44,8 +43,6 @@ jest.mock("../../../../src/utils/WellKnownUtils", () => ({
|
||||
getTileServerWellKnown: jest.fn(),
|
||||
}));
|
||||
|
||||
sdk.getComponent("views.messages.MLocationBody");
|
||||
|
||||
describe("MLocationBody", () => {
|
||||
describe("isSelfLocation", () => {
|
||||
it("Returns true for a full m.asset event", () => {
|
||||
|
||||
@@ -31,7 +31,6 @@ import {
|
||||
} from "matrix-events-sdk";
|
||||
import { MockedObject } from "jest-mock";
|
||||
|
||||
import sdk from "../../../skinned-sdk";
|
||||
import {
|
||||
UserVote,
|
||||
allVotes,
|
||||
@@ -43,11 +42,10 @@ import { MatrixClientPeg } from "../../../../src/MatrixClientPeg";
|
||||
import { IBodyProps } from "../../../../src/components/views/messages/IBodyProps";
|
||||
import { getMockClientWithEventEmitter } from "../../../test-utils";
|
||||
import MatrixClientContext from "../../../../src/contexts/MatrixClientContext";
|
||||
import MPollBody from "../../../../src/components/views/messages/MPollBody";
|
||||
|
||||
const CHECKED = "mx_MPollBody_option_checked";
|
||||
|
||||
const MPollBody = sdk.getComponent("views.messages.MPollBody");
|
||||
|
||||
const mockClient = getMockClientWithEventEmitter({
|
||||
getUserId: jest.fn().mockReturnValue("@me:example.com"),
|
||||
sendEvent: jest.fn().mockReturnValue(Promise.resolve({ "event_id": "fake_send_id" })),
|
||||
|
||||
@@ -17,14 +17,13 @@ limitations under the License.
|
||||
import React from "react";
|
||||
import { mount } from "enzyme";
|
||||
|
||||
import sdk from "../../../skinned-sdk";
|
||||
import { mkEvent, mkStubRoom } from "../../../test-utils";
|
||||
import { MatrixClientPeg } from "../../../../src/MatrixClientPeg";
|
||||
import * as languageHandler from "../../../../src/languageHandler";
|
||||
import * as TestUtils from "../../../test-utils";
|
||||
import DMRoomMap from "../../../../src/utils/DMRoomMap";
|
||||
import _TextualBody from "../../../../src/components/views/messages/TextualBody";
|
||||
|
||||
const _TextualBody = sdk.getComponent("views.messages.TextualBody");
|
||||
const TextualBody = TestUtils.wrapInMatrixClientContext(_TextualBody);
|
||||
|
||||
describe("<TextualBody />", () => {
|
||||
|
||||
Reference in New Issue
Block a user