Skip to content

Commit

Permalink
test: atoms의 공통 컴포넌트 테스트 추가 (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
saseungmin committed Jun 29, 2024
1 parent a7f2be6 commit 67a70c3
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/components/atoms/CounterCard/index.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { render } from '@testing-library/react';

import CounterCard from '.';

describe('CounterCard', () => {
const count = 10;

const renderCounterCard = () => render((
<CounterCard count={count} title="title" suffix="명" />
));

it('count가 나타나야만 한다', () => {
const { container } = renderCounterCard();

expect(container).toHaveTextContent(`${count}`);
});
});
17 changes: 17 additions & 0 deletions src/components/atoms/EventStatusBadge/index.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { render } from '@testing-library/react';

import EventStatusBadge from '.';

describe('EventStatusBadge', () => {
const title = 'title';

const renderEventStatusBadge = () => render((
<EventStatusBadge text="title" type="success" />
));

it('badge text가 보여야만한다', () => {
const { container } = renderEventStatusBadge();

expect(container).toHaveTextContent(title);
});
});
19 changes: 19 additions & 0 deletions src/components/atoms/SectionTitle/index.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { render } from '@testing-library/react';

import SectionTitle from '.';

describe('SectionTitle', () => {
const title = 'title';

const renderSectionTitle = () => render((
<SectionTitle title="title">
<div>children</div>
</SectionTitle>
));

it('section title이 보여야만한다', () => {
const { container } = renderSectionTitle();

expect(container).toHaveTextContent(title);
});
});

0 comments on commit 67a70c3

Please sign in to comment.