diff --git a/test/components/structures/MessagePanel-test.js b/test/components/structures/MessagePanel-test.js index 6f703b772d..1471c52eb8 100644 --- a/test/components/structures/MessagePanel-test.js +++ b/test/components/structures/MessagePanel-test.js @@ -24,7 +24,6 @@ import { mount } from "enzyme"; import * as TestUtils from "react-dom/test-utils"; import { MatrixClientPeg } from '../../../src/MatrixClientPeg'; -import sdk from '../../skinned-sdk'; import MessagePanel, { shouldFormContinuation } from "../../../src/components/structures/MessagePanel"; import SettingsStore from "../../../src/settings/SettingsStore"; import MatrixClientContext from "../../../src/contexts/MatrixClientContext"; @@ -32,6 +31,9 @@ import RoomContext from "../../../src/contexts/RoomContext"; import DMRoomMap from "../../../src/utils/DMRoomMap"; import { UnwrappedEventTile } from "../../../src/components/views/rooms/EventTile"; import * as TestUtilsMatrix from "../../test-utils"; +import EventListSummary from "../../../src/components/views/elements/EventListSummary"; +import GenericEventListSummary from "../../../src/components/views/elements/GenericEventListSummary"; +import DateSeparator from "../../../src/components/views/messages/DateSeparator"; let client; const room = new Matrix.Room("!roomId:server_name"); @@ -298,7 +300,7 @@ describe('MessagePanel', function() { expect(tiles.length).toEqual(2); const summaryTiles = TestUtils.scryRenderedComponentsWithType( - res, sdk.getComponent('elements.EventListSummary'), + res, EventListSummary, ); expect(summaryTiles.length).toEqual(1); }); @@ -443,7 +445,7 @@ describe('MessagePanel', function() { expect(tiles.at(0).props().mxEvent.getType()).toEqual("m.room.create"); expect(tiles.at(1).props().mxEvent.getType()).toEqual("m.room.encryption"); - const summaryTiles = res.find(sdk.getComponent('views.elements.GenericEventListSummary')); + const summaryTiles = res.find(GenericEventListSummary); const summaryTile = summaryTiles.at(0); const summaryEventTiles = summaryTile.find(UnwrappedEventTile); @@ -483,7 +485,7 @@ describe('MessagePanel', function() { events={events} />, ); - const Dates = res.find(sdk.getComponent('messages.DateSeparator')); + const Dates = res.find(DateSeparator); expect(Dates.length).toEqual(1); }); diff --git a/test/components/structures/auth/Login-test.tsx b/test/components/structures/auth/Login-test.tsx index 6d4acda762..af7e2599f0 100644 --- a/test/components/structures/auth/Login-test.tsx +++ b/test/components/structures/auth/Login-test.tsx @@ -20,9 +20,10 @@ import ReactTestUtils from 'react-dom/test-utils'; import { mocked } from 'jest-mock'; import { createClient, MatrixClient } from "matrix-js-sdk/src/matrix"; -import sdk from '../../../skinned-sdk'; import SdkConfig from '../../../../src/SdkConfig'; import { mkServerConfig } from "../../../test-utils"; +import Login from "../../../../src/components/structures/auth/Login"; +import PasswordLogin from "../../../../src/components/views/auth/PasswordLogin"; jest.mock("matrix-js-sdk/src/matrix"); @@ -30,10 +31,6 @@ const flushPromises = async () => await new Promise(process.nextTick); jest.useRealTimers(); -const Login = sdk.getComponent( - 'structures.auth.Login', -); - describe('Login', function() { let parentDiv; const mockClient = mocked({ @@ -80,7 +77,7 @@ describe('Login', function() { const form = ReactTestUtils.findRenderedComponentWithType( root, - sdk.getComponent('auth.PasswordLogin'), + PasswordLogin, ); expect(form).toBeTruthy(); @@ -94,7 +91,7 @@ describe('Login', function() { const form = ReactTestUtils.findRenderedComponentWithType( root, - sdk.getComponent('auth.PasswordLogin'), + PasswordLogin, ); expect(form).toBeTruthy(); @@ -118,7 +115,7 @@ describe('Login', function() { const root = render(); await flushPromises(); - const form = ReactTestUtils.findRenderedComponentWithType(root, sdk.getComponent('auth.PasswordLogin')); + const form = ReactTestUtils.findRenderedComponentWithType(root, PasswordLogin); expect(form).toBeTruthy(); const ssoButton = ReactTestUtils.findRenderedDOMComponentWithClass(root, "mx_SSOButton"); diff --git a/test/components/structures/auth/Registration-test.js b/test/components/structures/auth/Registration-test.js index 5e9d3c4d61..7a6fb0c976 100644 --- a/test/components/structures/auth/Registration-test.js +++ b/test/components/structures/auth/Registration-test.js @@ -19,17 +19,14 @@ import ReactDOM from 'react-dom'; import ReactTestUtils from 'react-dom/test-utils'; import { createClient } from 'matrix-js-sdk/src/matrix'; -import sdk from '../../../skinned-sdk'; import SdkConfig, { DEFAULTS } from '../../../../src/SdkConfig'; import { createTestClient, mkServerConfig } from "../../../test-utils"; +import Registration from "../../../../src/components/structures/auth/Registration"; +import RegistrationForm from "../../../../src/components/views/auth/RegistrationForm"; jest.mock('matrix-js-sdk/src/matrix'); jest.useFakeTimers(); -const Registration = sdk.getComponent( - 'structures.auth.Registration', -); - describe('Registration', function() { let parentDiv; @@ -79,7 +76,7 @@ describe('Registration', function() { const form = ReactTestUtils.findRenderedComponentWithType( root, - sdk.getComponent('auth.RegistrationForm'), + RegistrationForm, ); expect(form).toBeTruthy(); }); diff --git a/test/components/views/beacon/LeftPanelLiveShareWarning-test.tsx b/test/components/views/beacon/LeftPanelLiveShareWarning-test.tsx index 7ad06fcf12..680e61b89f 100644 --- a/test/components/views/beacon/LeftPanelLiveShareWarning-test.tsx +++ b/test/components/views/beacon/LeftPanelLiveShareWarning-test.tsx @@ -18,7 +18,6 @@ import React from 'react'; import { mocked } from 'jest-mock'; import { mount } from 'enzyme'; -import '../../../skinned-sdk'; import LeftPanelLiveShareWarning from '../../../../src/components/views/beacon/LeftPanelLiveShareWarning'; import { OwnBeaconStore, OwnBeaconStoreEvent } from '../../../../src/stores/OwnBeaconStore'; import { flushPromises } from '../../../test-utils'; diff --git a/test/components/views/beacon/RoomLiveShareWarning-test.tsx b/test/components/views/beacon/RoomLiveShareWarning-test.tsx index 93835c21a3..062ea04feb 100644 --- a/test/components/views/beacon/RoomLiveShareWarning-test.tsx +++ b/test/components/views/beacon/RoomLiveShareWarning-test.tsx @@ -20,7 +20,6 @@ import { mount } from 'enzyme'; import { Room, Beacon, BeaconEvent } from 'matrix-js-sdk/src/matrix'; import { logger } from 'matrix-js-sdk/src/logger'; -import '../../../skinned-sdk'; import RoomLiveShareWarning from '../../../../src/components/views/beacon/RoomLiveShareWarning'; import { OwnBeaconStore, OwnBeaconStoreEvent } from '../../../../src/stores/OwnBeaconStore'; import { diff --git a/test/components/views/beacon/StyledLiveBeaconIcon-test.tsx b/test/components/views/beacon/StyledLiveBeaconIcon-test.tsx index 38fc8391d5..f239a26470 100644 --- a/test/components/views/beacon/StyledLiveBeaconIcon-test.tsx +++ b/test/components/views/beacon/StyledLiveBeaconIcon-test.tsx @@ -17,7 +17,6 @@ limitations under the License. import React from 'react'; import { mount } from 'enzyme'; -import '../../../skinned-sdk'; import StyledLiveBeaconIcon from '../../../../src/components/views/beacon/StyledLiveBeaconIcon'; describe('', () => { diff --git a/test/components/views/dialogs/AccessSecretStorageDialog-test.js b/test/components/views/dialogs/AccessSecretStorageDialog-test.js index b429da4bc6..d90b23baac 100644 --- a/test/components/views/dialogs/AccessSecretStorageDialog-test.js +++ b/test/components/views/dialogs/AccessSecretStorageDialog-test.js @@ -18,12 +18,10 @@ import React from 'react'; import { mount } from 'enzyme'; import { act } from 'react-dom/test-utils'; -import sdk from '../../../skinned-sdk'; import { MatrixClientPeg } from '../../../../src/MatrixClientPeg'; import { stubClient } from '../../../test-utils'; import { findById, flushPromises } from '../../../test-utils'; - -const AccessSecretStorageDialog = sdk.getComponent("dialogs.security.AccessSecretStorageDialog"); +import AccessSecretStorageDialog from "../../../../src/components/views/dialogs/security/AccessSecretStorageDialog"; describe("AccessSecretStorageDialog", function() { it("Closes the dialog if _onRecoveryKeyNext is called with a valid key", async () => { diff --git a/test/components/views/dialogs/InteractiveAuthDialog-test.js b/test/components/views/dialogs/InteractiveAuthDialog-test.js index 86c803be2c..798a30886c 100644 --- a/test/components/views/dialogs/InteractiveAuthDialog-test.js +++ b/test/components/views/dialogs/InteractiveAuthDialog-test.js @@ -20,13 +20,9 @@ import ReactTestUtils from 'react-dom/test-utils'; import MatrixReactTestUtils from 'matrix-react-test-utils'; import { sleep } from "matrix-js-sdk/src/utils"; -import sdk from '../../../skinned-sdk'; import { MatrixClientPeg } from '../../../../src/MatrixClientPeg'; import * as TestUtilsMatrix from '../../../test-utils'; - -const InteractiveAuthDialog = sdk.getComponent( - 'views.dialogs.InteractiveAuthDialog', -); +import InteractiveAuthDialog from "../../../../src/components/views/dialogs/InteractiveAuthDialog"; describe('InteractiveAuthDialog', function() { let parentDiv; diff --git a/test/components/views/elements/EventListSummary-test.js b/test/components/views/elements/EventListSummary-test.js index 0fb21ecced..9ca5863aee 100644 --- a/test/components/views/elements/EventListSummary-test.js +++ b/test/components/views/elements/EventListSummary-test.js @@ -2,11 +2,11 @@ import React from 'react'; import ReactTestUtils from 'react-dom/test-utils'; import ShallowRenderer from "react-test-renderer/shallow"; -import sdk from '../../../skinned-sdk'; import * as testUtils from '../../../test-utils'; +import _EventListSummary from "../../../../src/components/views/elements/EventListSummary"; // Give ELS a matrixClient in its child context -const EventListSummary = testUtils.wrapInMatrixClientContext(sdk.getComponent('views.elements.EventListSummary')); +const EventListSummary = testUtils.wrapInMatrixClientContext(_EventListSummary); describe('EventListSummary', function() { // Generate dummy event tiles for use in simulating an expanded MELS diff --git a/test/components/views/location/LiveDurationDropdown-test.tsx b/test/components/views/location/LiveDurationDropdown-test.tsx index 864639db06..b07b9b9d22 100644 --- a/test/components/views/location/LiveDurationDropdown-test.tsx +++ b/test/components/views/location/LiveDurationDropdown-test.tsx @@ -18,7 +18,6 @@ import React from 'react'; import { mount } from 'enzyme'; import { act } from 'react-dom/test-utils'; -import '../../../skinned-sdk'; import LiveDurationDropdown, { DEFAULT_DURATION_MS } from '../../../../src/components/views/location/LiveDurationDropdown'; import { findById, mockPlatformPeg } from '../../../test-utils'; diff --git a/test/components/views/location/LocationButton-test.tsx b/test/components/views/location/LocationButton-test.tsx index 2737fa8354..2a247d472d 100644 --- a/test/components/views/location/LocationButton-test.tsx +++ b/test/components/views/location/LocationButton-test.tsx @@ -14,11 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. */ -import sdk from "../../../skinned-sdk"; import { textForLocation } from "../../../../src/components/views/location/shareLocation"; -sdk.getComponent("LocationPicker"); - describe("LocationButton", () => { describe("textForLocation", () => { it("with no description, simply dumps URI and date", () => { diff --git a/test/components/views/location/MapError-test.tsx b/test/components/views/location/MapError-test.tsx index 706e8e9188..2fa9cf3cd0 100644 --- a/test/components/views/location/MapError-test.tsx +++ b/test/components/views/location/MapError-test.tsx @@ -17,7 +17,6 @@ limitations under the License. import React from 'react'; import { mount } from 'enzyme'; -import '../../../skinned-sdk'; import { MapError } from '../../../../src/components/views/location/MapError'; import { LocationShareError } from '../../../../src/utils/location'; diff --git a/test/components/views/messages/DateSeparator-test.tsx b/test/components/views/messages/DateSeparator-test.tsx index 89987114b1..8e5b7ea3ca 100644 --- a/test/components/views/messages/DateSeparator-test.tsx +++ b/test/components/views/messages/DateSeparator-test.tsx @@ -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; diff --git a/test/components/views/messages/MLocationBody-test.tsx b/test/components/views/messages/MLocationBody-test.tsx index 1954609efa..e80a738534 100644 --- a/test/components/views/messages/MLocationBody-test.tsx +++ b/test/components/views/messages/MLocationBody-test.tsx @@ -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", () => { diff --git a/test/components/views/messages/MPollBody-test.tsx b/test/components/views/messages/MPollBody-test.tsx index b2c39ece21..28c0ceea34 100644 --- a/test/components/views/messages/MPollBody-test.tsx +++ b/test/components/views/messages/MPollBody-test.tsx @@ -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" })), diff --git a/test/components/views/messages/TextualBody-test.js b/test/components/views/messages/TextualBody-test.js index 5018663feb..702dd87bf4 100644 --- a/test/components/views/messages/TextualBody-test.js +++ b/test/components/views/messages/TextualBody-test.js @@ -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("", () => { diff --git a/test/components/views/right_panel/PinnedMessagesCard-test.tsx b/test/components/views/right_panel/PinnedMessagesCard-test.tsx index dce93be59f..da30ae50ee 100644 --- a/test/components/views/right_panel/PinnedMessagesCard-test.tsx +++ b/test/components/views/right_panel/PinnedMessagesCard-test.tsx @@ -31,7 +31,6 @@ import { PollEndEvent, } from "matrix-events-sdk"; -import "../../../skinned-sdk"; import { stubClient, mkStubRoom, diff --git a/test/components/views/rooms/MessageComposer-test.tsx b/test/components/views/rooms/MessageComposer-test.tsx index af7c67fe2b..e756a7653c 100644 --- a/test/components/views/rooms/MessageComposer-test.tsx +++ b/test/components/views/rooms/MessageComposer-test.tsx @@ -19,7 +19,6 @@ import { mount, ReactWrapper } from "enzyme"; import { RoomMember } from "matrix-js-sdk/src/models/room-member"; import { MatrixEvent } from "matrix-js-sdk/src/models/event"; -import '../../../skinned-sdk'; // Must be first for skinning to work import { createTestClient, mkEvent, mkStubRoom, stubClient } from "../../../test-utils"; import MessageComposer from "../../../../src/components/views/rooms/MessageComposer"; import MatrixClientContext from "../../../../src/contexts/MatrixClientContext"; diff --git a/test/components/views/rooms/MessageComposerButtons-test.tsx b/test/components/views/rooms/MessageComposerButtons-test.tsx index 436fbd21f4..31d8d1d6b6 100644 --- a/test/components/views/rooms/MessageComposerButtons-test.tsx +++ b/test/components/views/rooms/MessageComposerButtons-test.tsx @@ -19,15 +19,13 @@ import { mount, ReactWrapper } from "enzyme"; import { Room } from "matrix-js-sdk/src/models/room"; import { RoomMember } from "matrix-js-sdk/src/models/room-member"; -import sdk from "../../../skinned-sdk"; import MatrixClientContext from "../../../../src/contexts/MatrixClientContext"; import { Layout } from "../../../../src/settings/enums/Layout"; import RoomContext, { TimelineRenderingType } from "../../../../src/contexts/RoomContext"; import { createTestClient } from "../../../test-utils"; import { IRoomState } from "../../../../src/components/structures/RoomView"; import { MatrixClientPeg } from "../../../../src/MatrixClientPeg"; - -const MessageComposerButtons = sdk.getComponent("views.rooms.MessageComposerButtons"); +import MessageComposerButtons from "../../../../src/components/views/rooms/MessageComposerButtons"; describe("MessageComposerButtons", () => { it("Renders emoji and upload buttons in wide mode", () => { diff --git a/test/components/views/rooms/RoomList-test.js b/test/components/views/rooms/RoomList-test.js index 28d4409122..f13f24da8b 100644 --- a/test/components/views/rooms/RoomList-test.js +++ b/test/components/views/rooms/RoomList-test.js @@ -5,12 +5,14 @@ import { MatrixClient, Room, RoomMember } from 'matrix-js-sdk/src/matrix'; import * as TestUtils from '../../../test-utils'; import { MatrixClientPeg } from '../../../../src/MatrixClientPeg'; -import sdk from '../../../skinned-sdk'; import dis from '../../../../src/dispatcher/dispatcher'; import DMRoomMap from '../../../../src/utils/DMRoomMap'; import { DefaultTagID } from "../../../../src/stores/room-list/models"; import RoomListStore, { RoomListStoreClass } from "../../../../src/stores/room-list/RoomListStore"; import RoomListLayoutStore from "../../../../src/stores/room-list/RoomListLayoutStore"; +import RoomList from "../../../../src/components/views/rooms/RoomList"; +import RoomSublist from "../../../../src/components/views/rooms/RoomSublist"; +import RoomTile from "../../../../src/components/views/rooms/RoomTile"; function generateRoomId() { return '!' + Math.random().toString().slice(2, 10) + ':domain'; @@ -54,7 +56,6 @@ describe('RoomList', () => { parentDiv = document.createElement('div'); document.body.appendChild(parentDiv); - const RoomList = sdk.getComponent('views.rooms.RoomList'); const WrappedRoomList = TestUtils.wrapInMatrixClientContext(RoomList); root = ReactDOM.render( {}} />, @@ -119,10 +120,7 @@ describe('RoomList', () => { }); function expectRoomInSubList(room, subListTest) { - const RoomSubList = sdk.getComponent('views.rooms.RoomSublist'); - const RoomTile = sdk.getComponent('views.rooms.RoomTile'); - - const subLists = ReactTestUtils.scryRenderedComponentsWithType(root, RoomSubList); + const subLists = ReactTestUtils.scryRenderedComponentsWithType(root, RoomSublist); const containingSubList = subLists.find(subListTest); let expectedRoomTile; diff --git a/test/components/views/rooms/RoomTile-test.tsx b/test/components/views/rooms/RoomTile-test.tsx index 4e960afe46..1bac119dee 100644 --- a/test/components/views/rooms/RoomTile-test.tsx +++ b/test/components/views/rooms/RoomTile-test.tsx @@ -21,7 +21,6 @@ import { mocked } from "jest-mock"; import { MatrixEvent } from "matrix-js-sdk/src/models/event"; import { RoomMember } from "matrix-js-sdk/src/models/room-member"; -import "../../../skinned-sdk"; import { stubClient, mockStateEventImplementation, diff --git a/test/components/views/rooms/SearchResultTile-test.tsx b/test/components/views/rooms/SearchResultTile-test.tsx index b87934315f..9f0e2d8576 100644 --- a/test/components/views/rooms/SearchResultTile-test.tsx +++ b/test/components/views/rooms/SearchResultTile-test.tsx @@ -20,12 +20,10 @@ import { SearchResult } from "matrix-js-sdk/src/models/search-result"; import { MatrixEvent } from "matrix-js-sdk/src/models/event"; import { EventType } from "matrix-js-sdk/src/@types/event"; -import sdk from "../../../skinned-sdk"; import { createTestClient } from "../../../test-utils"; import EventTile from "../../../../src/components/views/rooms/EventTile"; import { MatrixClientPeg } from "../../../../src/MatrixClientPeg"; - -const SearchResultTile = sdk.getComponent("views.rooms.SearchResultTile"); +import SearchResultTile from "../../../../src/components/views/rooms/SearchResultTile"; describe("SearchResultTile", () => { beforeAll(() => { diff --git a/test/components/views/voip/VoiceChannelRadio-test.tsx b/test/components/views/voip/VoiceChannelRadio-test.tsx index b42ac0e089..50779dd9f7 100644 --- a/test/components/views/voip/VoiceChannelRadio-test.tsx +++ b/test/components/views/voip/VoiceChannelRadio-test.tsx @@ -19,7 +19,6 @@ import { mount } from "enzyme"; import { act } from "react-dom/test-utils"; import { mocked } from "jest-mock"; -import "../../../skinned-sdk"; import { stubClient, mkStubRoom, wrapInMatrixClientContext } from "../../../test-utils"; import { stubVoiceChannelStore } from "../../../test-utils/voice"; import _VoiceChannelRadio from "../../../../src/components/views/voip/VoiceChannelRadio";