Skip to content

Commit

Permalink
[KAN-133] test: 테스트 케이스 모킹 함수 추가하여 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
HMRyu committed Oct 17, 2024
1 parent a6927c2 commit 24c445b
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/app/components/CardList/CardList.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ jest.mock('@/public/icons', () => ({
IconPerson: () => <div data-testid='IconPerson' />,
}));

// 함수 모킹
jest.mock('@/app/(main)/gatherings/_helpers/getTagMessage', () =>
jest.fn().mockReturnValue('오늘 15시 마감'),
);
jest.mock('@/app/(main)/gatherings/_helpers/isClosingTagVisible', () =>
jest.fn().mockReturnValue(true),
);

// 기본 렌더링 테스트
describe('CardList Component', () => {
const MOCK_DATA = {
Expand Down Expand Up @@ -92,8 +100,7 @@ describe('Tag Component Render', () => {
};

render(<CardList data={MOCK_DATA} />);
const tagElement = screen.getByText(/오늘 \d{1,2}시 마감/);
expect(tagElement).toBeInTheDocument();
expect(screen.getByText(/오늘 \d{1,2}시 마감/)).toBeInTheDocument();
});
});

Expand Down

0 comments on commit 24c445b

Please sign in to comment.