Skip to content

Commit a987ead

Browse files
committed
Step 8.1: Remove skinning setup from all tests
1 parent 9350c50 commit a987ead

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+3
-129
lines changed

scripts/make-react-component.js

+3-7
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const path = require('path');
66
* Unsophisticated script to create a styled, unit-tested react component.
77
* -filePath / -f : path to the component to be created, including new component name, excluding extension, relative to src
88
* -withStyle / -s : optional, flag to create a style file for the component. Defaults to false.
9-
*
9+
*
1010
* eg:
1111
* ```
1212
* node srcipts/make-react-component.js -f components/toasts/NewToast -s
@@ -15,7 +15,7 @@ const path = require('path');
1515
* - src/components/toasts/NewToast.tsx
1616
* - test/components/toasts/NewToast-test.tsx
1717
* - res/css/components/toasts/_NewToast.scss
18-
*
18+
*
1919
*/
2020

2121
const TEMPLATES = {
@@ -34,7 +34,6 @@ export default %%ComponentName%%;
3434
import React from 'react';
3535
import { mount } from 'enzyme';
3636
37-
import '%%SkinnedSdkPath%%';
3837
import %%ComponentName%% from '%%RelativeComponentPath%%';
3938
4039
describe('<%%ComponentName%% />', () => {
@@ -85,10 +84,8 @@ const makeFile = async ({
8584
const relativePathToComponent = path.parse(path.relative(path.dirname(newFilePath), componentFilePath || ''));
8685
const importComponentPath = path.join(relativePathToComponent.dir, relativePathToComponent.name);
8786

88-
const skinnedSdkPath = path.relative(path.dirname(newFilePath), 'test/skinned-sdk')
89-
9087
try {
91-
await fs.writeFile(newFilePath, fillTemplate(template, componentName, importComponentPath, skinnedSdkPath), { flag: 'wx' });
88+
await fs.writeFile(newFilePath, fillTemplate(template, componentName, importComponentPath), { flag: 'wx' });
9289
console.log(`Created ${path.relative(process.cwd(), newFilePath)}`);
9390
return newFilePath;
9491
} catch (error) {
@@ -104,7 +101,6 @@ const makeFile = async ({
104101
const fillTemplate = (template, componentName, relativeComponentFilePath, skinnedSdkPath) =>
105102
template.replace(/%%ComponentName%%/g, componentName)
106103
.replace(/%%RelativeComponentPath%%/g, relativeComponentFilePath)
107-
.replace(/%%SkinnedSdkPath%%/g, skinnedSdkPath)
108104

109105

110106
const makeReactComponent = async () => {

test/CallHandler-test.ts

-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
import './skinned-sdk';
18-
1917
import { IProtocol } from 'matrix-js-sdk/src/matrix';
2018
import { CallEvent, CallState, CallType } from 'matrix-js-sdk/src/webrtc/call';
2119
import EventEmitter from 'events';

test/DecryptionFailureTracker-test.js

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ limitations under the License.
1616

1717
import { MatrixEvent } from 'matrix-js-sdk/src/matrix';
1818

19-
import './skinned-sdk'; // Must be first for skinning to work
2019
import { DecryptionFailureTracker } from '../src/DecryptionFailureTracker';
2120

2221
class MockDecryptionError extends Error {

test/DeviceListener-test.ts

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import { EventEmitter } from "events";
1919
import { mocked } from "jest-mock";
2020
import { Room } from "matrix-js-sdk/src/matrix";
2121

22-
import './skinned-sdk';
2322
import DeviceListener from "../src/DeviceListener";
2423
import { MatrixClientPeg } from "../src/MatrixClientPeg";
2524
import * as SetupEncryptionToast from "../src/toasts/SetupEncryptionToast";

test/Image-test.ts

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ limitations under the License.
1717
import fs from "fs";
1818
import path from "path";
1919

20-
import './skinned-sdk';
2120
import { blobIsAnimated, mayBeAnimated } from "../src/utils/Image";
2221

2322
describe("Image", () => {

test/Reply-test.ts

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
import './skinned-sdk';
1817
import {
1918
getNestedReplyText,
2019
getParentEventId,

test/TextForEvent-test.ts

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import './skinned-sdk';
2-
31
import { EventType, MatrixEvent } from "matrix-js-sdk/src/matrix";
42
import TestRenderer from 'react-test-renderer';
53

test/accessibility/RovingTabIndex-test.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
import '../skinned-sdk'; // Must be first for skinning to work
1817
import * as React from "react";
1918
import { mount, ReactWrapper } from "enzyme";
2019

test/audio/Playback-test.ts

-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ limitations under the License.
1717
import { mocked } from 'jest-mock';
1818
import { logger } from 'matrix-js-sdk/src/logger';
1919

20-
import '../skinned-sdk'; // Must be first for skinning to work
21-
2220
import { createAudioContext, decodeOgg } from '../../src/audio/compat';
2321
import { Playback, PlaybackState } from "../../src/audio/Playback";
2422

test/components/structures/CallEventGrouper-test.ts

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
import "../../skinned-sdk";
1817
import { MatrixClient, MatrixEvent } from 'matrix-js-sdk/src/matrix';
1918
import { EventType } from "matrix-js-sdk/src/@types/event";
2019
import { CallState } from "matrix-js-sdk/src/webrtc/call";

test/components/structures/RightPanel-test.tsx

-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ import TestRenderer from "react-test-renderer";
1919
import { jest } from "@jest/globals";
2020
import { Room } from "matrix-js-sdk/src/models/room";
2121

22-
// We can't use the usual `skinned-sdk`, as it stubs out the RightPanel
23-
import "../../minimal-sdk";
2422
import RightPanel from "../../../src/components/structures/RightPanel";
2523
import { MatrixClientPeg } from "../../../src/MatrixClientPeg";
2624
import ResizeNotifier from "../../../src/utils/ResizeNotifier";

test/components/structures/ThreadPanel-test.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ limitations under the License.
1616

1717
import React from 'react';
1818
import { shallow, mount } from "enzyme";
19-
import '../../skinned-sdk';
2019

2120
import {
2221
ThreadFilterType,

test/components/views/audio_messages/RecordingPlayback-test.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import { mocked } from 'jest-mock';
2020
import { logger } from 'matrix-js-sdk/src/logger';
2121
import { act } from 'react-dom/test-utils';
2222

23-
import '../../../skinned-sdk';
2423
import RecordingPlayback from '../../../../src/components/views/audio_messages/RecordingPlayback';
2524
import { Playback } from '../../../../src/audio/Playback';
2625
import RoomContext, { TimelineRenderingType } from '../../../../src/contexts/RoomContext';

test/components/views/context_menus/ContextMenu-test.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ limitations under the License.
1717
import React from "react";
1818
import { mount } from "enzyme";
1919

20-
import "../../../skinned-sdk";
2120
import ContextMenu, { ChevronFace } from "../../../../src/components/structures/ContextMenu";
2221
import UIStore from "../../../../src/stores/UIStore";
2322

test/components/views/context_menus/MessageContextMenu-test.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import { Room } from 'matrix-js-sdk/src/models/room';
2121
import { PendingEventOrdering } from 'matrix-js-sdk/src/matrix';
2222
import { ExtensibleEvent, MessageEvent, M_POLL_KIND_DISCLOSED, PollStartEvent } from 'matrix-events-sdk';
2323

24-
import '../../../skinned-sdk';
2524
import * as TestUtils from '../../../test-utils';
2625
import MessageContextMenu from '../../../../src/components/views/context_menus/MessageContextMenu';
2726
import { MatrixClientPeg } from '../../../../src/MatrixClientPeg';

test/components/views/context_menus/SpaceContextMenu-test.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import { Room } from 'matrix-js-sdk/src/matrix';
2020
import { mocked } from 'jest-mock';
2121
import { act } from 'react-dom/test-utils';
2222

23-
import '../../../skinned-sdk';
2423
import SpaceContextMenu from '../../../../src/components/views/context_menus/SpaceContextMenu';
2524
import MatrixClientContext from '../../../../src/contexts/MatrixClientContext';
2625
import { findByTestId } from '../../../test-utils';

test/components/views/dialogs/ExportDialog-test.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import { mocked } from 'jest-mock';
2020
import { act } from "react-dom/test-utils";
2121
import { Room } from 'matrix-js-sdk/src/matrix';
2222

23-
import '../../../skinned-sdk';
2423
import ExportDialog from '../../../../src/components/views/dialogs/ExportDialog';
2524
import { ExportType, ExportFormat } from '../../../../src/utils/exportUtils/exportUtils';
2625
import { createTestClient, mkStubRoom } from '../../../test-utils';

test/components/views/dialogs/ForwardDialog-test.js

-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
import "../../../skinned-sdk";
18-
1917
import React from "react";
2018
import { mount } from "enzyme";
2119
import { act } from "react-dom/test-utils";

test/components/views/elements/AppTile-test.tsx

-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ import { jest } from "@jest/globals";
2020
import { Room } from "matrix-js-sdk/src/models/room";
2121
import { MatrixWidgetType } from "matrix-widget-api";
2222

23-
// We can't use the usual `skinned-sdk`, as it stubs out the RightPanel
24-
import "../../../minimal-sdk";
2523
import RightPanel from "../../../../src/components/structures/RightPanel";
2624
import { MatrixClientPeg } from "../../../../src/MatrixClientPeg";
2725
import ResizeNotifier from "../../../../src/utils/ResizeNotifier";

test/components/views/elements/InteractiveTooltip-test.ts

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
import '../../../skinned-sdk';
1817
import { Direction, mouseWithinRegion } from "../../../../src/components/views/elements/InteractiveTooltip";
1918

2019
describe("InteractiveTooltip", () => {

test/components/views/elements/PollCreateDialog-test.tsx

-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
// skinned-sdk should be the first import in most tests
18-
import '../../../skinned-sdk';
1917
import React from "react";
2018
import { mount, ReactWrapper } from "enzyme";
2119
import { Room } from "matrix-js-sdk/src/models/room";

test/components/views/elements/ReplyChain-test.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
import "../../../skinned-sdk";
1817
import * as testUtils from '../../../test-utils';
1918
import { getParentEventId } from "../../../../src/utils/Reply";
2019

test/components/views/elements/StyledRadioGroup-test.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
16-
import "../../../skinned-sdk";
1716

1817
import React from 'react';
1918
import { mount } from 'enzyme';

test/components/views/elements/TooltipTarget-test.tsx

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// skinned-sdk should be the first import in most tests
2-
import '../../../skinned-sdk';
31
import React from "react";
42
import {
53
renderIntoDocument,

test/components/views/location/LocationPicker-test.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import { MatrixClient } from 'matrix-js-sdk/src/client';
2323
import { mocked } from 'jest-mock';
2424
import { logger } from 'matrix-js-sdk/src/logger';
2525

26-
import "../../../skinned-sdk"; // Must be first for skinning to work
2726
import LocationPicker from "../../../../src/components/views/location/LocationPicker";
2827
import { LocationShareType } from "../../../../src/components/views/location/shareLocation";
2928
import MatrixClientContext from '../../../../src/contexts/MatrixClientContext';

test/components/views/location/LocationShareMenu-test.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import { M_BEACON_INFO } from 'matrix-js-sdk/src/@types/beacon';
2424
import { M_ASSET, LocationAssetType } from 'matrix-js-sdk/src/@types/location';
2525
import { logger } from 'matrix-js-sdk/src/logger';
2626

27-
import '../../../skinned-sdk';
2827
import LocationShareMenu from '../../../../src/components/views/location/LocationShareMenu';
2928
import MatrixClientContext from '../../../../src/contexts/MatrixClientContext';
3029
import { ChevronFace } from '../../../../src/components/structures/ContextMenu';

test/components/views/messages/MKeyVerificationConclusion-test.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import '../../../skinned-sdk'; // Must be first for skinning to work
21
import React from 'react';
32
import TestRenderer from 'react-test-renderer';
43
import { EventEmitter } from 'events';

test/components/views/right_panel/UserInfo-test.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import { act } from "react-dom/test-utils";
2121
import { Room, User, MatrixClient } from 'matrix-js-sdk/src/matrix';
2222
import { Phase, VerificationRequest } from 'matrix-js-sdk/src/crypto/verification/request/VerificationRequest';
2323

24-
import "../../../skinned-sdk";
2524
import UserInfo from '../../../../src/components/views/right_panel/UserInfo';
2625
import { RightPanelPhases } from '../../../../src/stores/right-panel/RightPanelStorePhases';
2726
import { MatrixClientPeg } from '../../../../src/MatrixClientPeg';

test/components/views/rooms/MemberList-test.tsx

-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
import "../../../skinned-sdk";
18-
1917
import React from 'react';
2018
import ReactTestUtils from 'react-dom/test-utils';
2119
import ReactDOM from 'react-dom';

test/components/views/rooms/RoomHeader-test.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import React from 'react';
22
import { mount, ReactWrapper } from 'enzyme';
33
import { Room, PendingEventOrdering, MatrixEvent, MatrixClient } from 'matrix-js-sdk/src/matrix';
44

5-
import "../../../skinned-sdk";
65
import * as TestUtils from '../../../test-utils';
76
import { MatrixClientPeg } from '../../../../src/MatrixClientPeg';
87
import DMRoomMap from '../../../../src/utils/DMRoomMap';

test/components/views/rooms/RoomPreviewBar-test.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import {
2323
} from 'react-dom/test-utils';
2424
import { Room, RoomMember, MatrixError, IContent } from 'matrix-js-sdk/src/matrix';
2525

26-
import "../../../skinned-sdk";
2726
import { stubClient } from '../../../test-utils';
2827
import { MatrixClientPeg } from '../../../../src/MatrixClientPeg';
2928
import DMRoomMap from '../../../../src/utils/DMRoomMap';

test/components/views/rooms/SendMessageComposer-test.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import { sleep } from "matrix-js-sdk/src/utils";
2020
import { MatrixClient } from "matrix-js-sdk/src/matrix";
2121
import { mount } from 'enzyme';
2222

23-
import '../../../skinned-sdk'; // Must be first for skinning to work
2423
import SendMessageComposer, {
2524
createMessageContent,
2625
isQuickReaction,

test/components/views/settings/CryptographyPanel-test.tsx

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import '../../../skinned-sdk';
2-
31
import React, { ReactElement } from 'react';
42
import ReactDOM from 'react-dom';
53
import { MatrixClient } from 'matrix-js-sdk/src/matrix';

test/components/views/settings/FontScalingPanel-test.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ limitations under the License.
1717
import React from 'react';
1818
import { mount } from "enzyme";
1919

20-
import '../../../skinned-sdk';
2120
import * as TestUtils from "../../../test-utils";
2221
import FontScalingPanel from '../../../../src/components/views/settings/FontScalingPanel';
2322

test/components/views/settings/Notifications-test.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ limitations under the License.
1414

1515
import React from 'react';
1616
import { mount } from 'enzyme';
17-
import '../../../skinned-sdk';
1817
import { IPushRule, IPushRules, RuleId, IPusher } from 'matrix-js-sdk/src/matrix';
1918
import { IThreepid, ThreepidMedium } from 'matrix-js-sdk/src/@types/threepids';
2019
import { act } from 'react-dom/test-utils';

test/components/views/settings/ThemeChoicePanel-test.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ limitations under the License.
1717
import React from 'react';
1818
import { mount } from "enzyme";
1919

20-
import '../../../skinned-sdk';
2120
import * as TestUtils from "../../../test-utils";
2221
import ThemeChoicePanel from '../../../../src/components/views/settings/ThemeChoicePanel';
2322

test/components/views/spaces/QuickThemeSwitcher-test.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import { mount } from 'enzyme';
1919
import { mocked } from 'jest-mock';
2020
import { act } from 'react-dom/test-utils';
2121

22-
import '../../../skinned-sdk';
2322
import QuickThemeSwitcher from '../../../../src/components/views/spaces/QuickThemeSwitcher';
2423
import { getOrderedThemes } from '../../../../src/theme';
2524
import ThemeChoicePanel from '../../../../src/components/views/settings/ThemeChoicePanel';

test/components/views/spaces/SpacePanel-test.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import { mocked } from 'jest-mock';
2020
import { MatrixClient } from 'matrix-js-sdk/src/matrix';
2121
import { act } from "react-dom/test-utils";
2222

23-
import '../../../skinned-sdk';
2423
import SpacePanel from '../../../../src/components/views/spaces/SpacePanel';
2524
import { MatrixClientPeg } from '../../../../src/MatrixClientPeg';
2625
import { SpaceKey } from '../../../../src/stores/spaces';

test/components/views/spaces/SpaceSettingsVisibilityTab-test.tsx

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// skinned-sdk should be the first import in most tests
2-
import '../../../skinned-sdk';
31
import React from "react";
42
import { mocked } from 'jest-mock';
53
import {

test/createRoom-test.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import './skinned-sdk'; // Must be first for skinning to work
21
import { EventEmitter } from 'events';
32

43
import { waitForMember, canEncryptToAllUsers } from '../src/createRoom';

test/editor/caret-test.js

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
import "../skinned-sdk"; // Must be first for skinning to work
1817
import { getLineAndNodePosition } from "../../src/editor/caret";
1918
import EditorModel from "../../src/editor/model";
2019
import { createPartCreator } from "./mock";

test/editor/deserialize-test.js

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
import '../skinned-sdk'; // Must be first for skinning to work
1817
import { parseEvent } from "../../src/editor/deserialize";
1918
import { createPartCreator } from "./mock";
2019

test/editor/model-test.js

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
import "../skinned-sdk"; // Must be first for skinning to work
1817
import EditorModel from "../../src/editor/model";
1918
import { createPartCreator, createRenderer } from "./mock";
2019

test/editor/operations-test.js

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
import "../skinned-sdk"; // Must be first for skinning to work
1817
import EditorModel from "../../src/editor/model";
1918
import { createPartCreator, createRenderer } from "./mock";
2019
import {

test/editor/position-test.js

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
import "../skinned-sdk"; // Must be first for skinning to work
1817
import EditorModel from "../../src/editor/model";
1918
import { createPartCreator } from "./mock";
2019

test/editor/range-test.js

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
import "../skinned-sdk"; // Must be first for skinning to work
1817
import EditorModel from "../../src/editor/model";
1918
import { createPartCreator, createRenderer } from "./mock";
2019

0 commit comments

Comments
 (0)