Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move tchap unit-tests into single folder, and run jest on that folder only #770

Merged
merged 1 commit into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading