Skip to content

Commit

Permalink
chore: fix prettier issues
Browse files Browse the repository at this point in the history
  • Loading branch information
marc.sirisak committed Mar 21, 2024
1 parent 45a0a7a commit 560884b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 13 deletions.
2 changes: 1 addition & 1 deletion jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const config: Config = {
"<rootDir>/node_modules/matrix-react-sdk/src/components/views/messages/MAudioBody.tsx",
"MStickerBody": "<rootDir>/src/tchap/customisations/components/views/messages/ContentScanningStickerBody.tsx",
"~tchap-web-dep/(.*)": "<rootDir>/yarn-linked-dependencies/$1",
"~tchap-web/(.*)": "<rootDir>/$1"
"~tchap-web/(.*)": "<rootDir>/$1",
// end :TCHAP:
},
transformIgnorePatterns: ["/node_modules/(?!matrix-js-sdk|matrix-react-sdk).+$"],
Expand Down
2 changes: 1 addition & 1 deletion test/setupTests.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//is duplicated from matrix-react-sdk/test/setupTests.js in order to work
import Adapter from "@wojtekmaj/enzyme-adapter-react-17";
import '@testing-library/jest-dom';
import "@testing-library/jest-dom";
// eslint-disable-next-line deprecate/import
import { configure } from "enzyme";
configure({ adapter: new Adapter() });
15 changes: 5 additions & 10 deletions test/unit-tests/tchap/components/structures/UserMenu-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,17 @@ describe("<UserMenu>", () => {
beforeEach(() => {
client = stubClient();
sdkContext = new TestSdkContext();

});

describe("<UserMenu> UI", () => {

beforeEach(() => {
const UserMenu = wrapInSdkContext(UnwrappedUserMenu, sdkContext);
render(<UserMenu isPanelCollapsed={false} />);
})
});

// If this snapshot change, you should consider to check what change on the UI side from element
// it"s a good indicator to see if this could introduce some regression on our code
it("should render as expected", async () => {

// open the user menu
screen.getByRole("button", { name: "a11y" }).click();

Expand All @@ -39,12 +36,12 @@ describe("<UserMenu>", () => {
// ...
});

// Here you can add some business logic check
// Here you can add some business logic check
describe("<UserMenu> faq", () => {
beforeEach(() => {
const UserMenu = wrapInSdkContext(UnwrappedUserMenu, sdkContext);
render(<UserMenu isPanelCollapsed={true} />);
})
});

it("should open the faq when clicking on the faq button", () => {
global.open = jest.fn();
Expand All @@ -54,11 +51,9 @@ describe("<UserMenu>", () => {
screen.getByRole("menuitem", { name: "common" }).click();
expect(global.open).toHaveBeenCalledTimes(1);
expect(global.open).toHaveBeenCalledWith("https://www.tchap.gouv.fr/faq", "_blank");
})
});
});

// Here are the tests for checking the props of the component
describe("<UserMenu> props", () => {

})
describe("<UserMenu> props", () => {});
});
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
/* :TCHAP: */
"paths": {
"~tchap-web/*": ["./*"],
"~tchap-web-dep/*": ["./yarn-linked-dependencies/*"]
"~tchap-web-dep/*": ["./yarn-linked-dependencies/*"],
},
"types": ["node", "jest", "@testing-library/jest-dom"],
/* end :TCHAP: */
Expand Down

0 comments on commit 560884b

Please sign in to comment.