Skip to content

Commit 53e6528

Browse files
committed
fix: updated card.test and jest. config
1 parent 76bf9a4 commit 53e6528

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

jest.config.mjs

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const sharedConfig = {
1313
coveragePathIgnorePatterns: ["<rootDir>/build/", "<rootDir>/node_modules/"],
1414
moduleNameMapper: {
1515
"^@/(.*)$": "<rootDir>/src/$1",
16+
"^@chingu-x/components/(.*)$": "<rootDir>/node_modules/@chingu-x/components/dist/$1",
1617
},
1718
};
1819

src/app/(main)/my-voyage/[teamId]/features/components/Card.test.tsx

+5-2
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ jest.mock("@hello-pangea/dnd", () => ({
4848
</div>
4949
),
5050
}));
51+
jest.mock("@chingu-x/components/avatar", () => ({
52+
Avatar: jest.fn(() => <div>Mocked Avatar</div>),
53+
}));
5154

5255
// "current user" id is 25b7b76c-1567-4910-9d50-e78819daccf1
5356
const renderWithStore = (feature: Feature, userId: string) => {
@@ -76,7 +79,7 @@ describe("Feature Card component", () => {
7679
);
7780

7881
const cardAction = card.getByRole("button", { name: /feature menu/i });
79-
const avatar = card.queryByRole("img", { name: /avatar/i });
82+
const avatar = card.queryByText("Mocked Avatar");
8083

8184
expect(cardAction).toBeInTheDocument();
8285
expect(avatar).not.toBeInTheDocument();
@@ -89,7 +92,7 @@ describe("Feature Card component", () => {
8992
);
9093

9194
const cardAction = card.queryByRole("button", { name: /feature menu/i });
92-
const avatar = card.getByRole("img", { name: /avatar/i });
95+
const avatar = card.queryByText("Mocked Avatar");
9396

9497
expect(cardAction).not.toBeInTheDocument();
9598
expect(avatar).toBeInTheDocument();

0 commit comments

Comments
 (0)