Skip to content

Commit

Permalink
Merge pull request #770 from tchapgouv/stop-running-element-tests
Browse files Browse the repository at this point in the history
Move tchap unit-tests into single folder, and run jest on that folder only
  • Loading branch information
estellecomment authored Oct 31, 2023
2 parents ed1f5e3 + 78e25d4 commit b5bcb4d
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const config: Config = {
testEnvironmentOptions: {
url: "http://localhost/",
},
testMatch: ["<rootDir>/test/unit-tests/**/*-test.[tj]s?(x)"],
testMatch: ["<rootDir>/test/unit-tests/tchap/**/*-test.[tj]s?(x)"], // :TCHAP: only tchap tests
setupFiles: ["jest-canvas-mock"],
setupFilesAfterEnv: ["<rootDir>/test/setupTests.ts", "<rootDir>/node_modules/matrix-react-sdk/test/setupTests.ts"],
moduleNameMapper: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import { act } from "react-dom/test-utils";
import { MatrixClientPeg } from "matrix-react-sdk/src/MatrixClientPeg";
import { EventEmitter } from "events";

import { TchapRoomType } from "../../../../../src/tchap/@types/tchap";
import TchapUtils from "../../../../../src/tchap/util/TchapUtils";
import TchapCreateRoomDialog from "../../../../../src/tchap/components/views/dialogs/TchapCreateRoomDialog";
import { TchapRoomType } from "../../../../../../src/tchap/@types/tchap";
import TchapUtils from "../../../../../../src/tchap/util/TchapUtils";
import TchapCreateRoomDialog from "../../../../../../src/tchap/components/views/dialogs/TchapCreateRoomDialog";

//mocking module with jest.mock should be done outside the test. Before any import of the mocked module.
//I could not make a mock of TchapCreateRoomDialog, the real implementation was taken each time. Then I used jest spyOn
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import {
} from "matrix-react-sdk/test/test-utils/test-utils";
import { JoinRule, MatrixClient, Room } from "matrix-js-sdk/src/matrix";

import TchapJoinRuleSettings from "../../../../../src/tchap/components/views/settings/TchapJoinRuleSettings";
import { TchapRoomAccessRule, TchapRoomAccessRulesEventId } from "../../../../../src/tchap/@types/tchap";
import TchapJoinRuleSettings from "../../../../../../src/tchap/components/views/settings/TchapJoinRuleSettings";
import { TchapRoomAccessRule, TchapRoomAccessRulesEventId } from "../../../../../../src/tchap/@types/tchap";

function mkStubRoomWithInviteRule(roomId: string, name: string, client: MatrixClient, joinRule: JoinRule): Room {
const stubRoom: Room = mkStubRoom(roomId, name, client);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { TchapRoomType } from "../../../src/tchap/@types/tchap";
import TchapCreateRoom from "../../../src/tchap/lib/createTchapRoom";
import { TchapRoomType } from "../../../../src/tchap/@types/tchap";
import TchapCreateRoom from "../../../../src/tchap/lib/createTchapRoom";

// todo(estellecomment) : these tests are redundant with TchapCreateRoomDialog-test. Either remove them or modify TchapCreateRoomDialog
// to not edit state directly.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { TchapRoomAccessRule, TchapRoomType } from "../../../src/tchap/@types/tchap";
import TchapRoomUtils from "../../../src/tchap/util/TchapRoomUtils";
import { TchapRoomAccessRule, TchapRoomType } from "../../../../src/tchap/@types/tchap";
import TchapRoomUtils from "../../../../src/tchap/util/TchapRoomUtils";

describe("Provides utils method to get room type and state", () => {
beforeEach(() => {});
Expand Down

0 comments on commit b5bcb4d

Please sign in to comment.