Skip to content

Commit 0864412

Browse files
chore(deps): update dependency postcss to v8.5.17 (#607)
* chore(deps): update dependency postcss to v8.5.17 * chore: Set test --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: 1ilsang <1ilsang.dev@gmail.com>
1 parent 379a9ce commit 0864412

22 files changed

Lines changed: 918 additions & 42 deletions

pnpm-lock.yaml

Lines changed: 24 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { render, screen } from '@testing-library/react';
2+
3+
import { ActivityType, type Activity } from './models';
4+
import { CardItem } from './CardItem';
5+
6+
const activity: Activity = {
7+
name: 'FEConf',
8+
type: ActivityType.conference,
9+
startDate: 2024,
10+
url: 'https://feconf.kr',
11+
};
12+
13+
describe('CardItem', () => {
14+
it('should render activity type and external link', () => {
15+
render(
16+
<ul>
17+
<CardItem activity={activity} />
18+
</ul>,
19+
);
20+
21+
expect(screen.getByText(ActivityType.conference)).toBeVisible();
22+
const link = screen.getByRole('link', { name: 'FEConf' });
23+
expect(link).toHaveAttribute('href', 'https://feconf.kr');
24+
expect(link).toHaveAttribute('target', '_blank');
25+
});
26+
});
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { render, screen } from '@testing-library/react';
2+
import userEvent from '@testing-library/user-event';
3+
4+
import { Label } from './Label';
5+
6+
describe('Label', () => {
7+
it('should render static heading when onClick is omitted', () => {
8+
render(<Label label="WORK EXPERIENCE" />);
9+
10+
expect(screen.getByText('WORK EXPERIENCE')).toBeVisible();
11+
expect(screen.queryByRole('button')).not.toBeInTheDocument();
12+
});
13+
14+
it('should render interactive button and handle click/keyboard', async () => {
15+
const onClick = jest.fn();
16+
render(<Label label="WORK EXPERIENCE" onClick={onClick} ariaExpanded />);
17+
18+
const button = screen.getByRole('button', { name: 'WORK EXPERIENCE' });
19+
expect(button).toHaveAttribute('aria-expanded', 'true');
20+
21+
await userEvent.click(button);
22+
expect(onClick).toHaveBeenCalledTimes(1);
23+
24+
button.focus();
25+
await userEvent.keyboard('{Enter}');
26+
expect(onClick).toHaveBeenCalledTimes(2);
27+
28+
await userEvent.keyboard(' ');
29+
expect(onClick).toHaveBeenCalledTimes(3);
30+
31+
await userEvent.keyboard('a');
32+
expect(onClick).toHaveBeenCalledTimes(3);
33+
});
34+
});
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { render, screen } from '@testing-library/react';
2+
3+
import { ProjectDate } from './ProjectDate';
4+
5+
describe('ProjectDate', () => {
6+
it('should render start and end dates', () => {
7+
render(
8+
<ProjectDate
9+
startDate={Date.UTC(2020, 0, 1)}
10+
endDate={Date.UTC(2022, 0, 1)}
11+
format="yyyy"
12+
className="extra"
13+
/>,
14+
);
15+
16+
expect(screen.getByText('2020')).toBeVisible();
17+
expect(screen.getByText('2022')).toBeVisible();
18+
expect(screen.getByText(/-/)).toBeVisible();
19+
});
20+
21+
it('should render Present when endDate is missing', () => {
22+
const { container } = render(
23+
<ProjectDate startDate={Date.UTC(2023, 0, 1)} format="yyyy" />,
24+
);
25+
26+
expect(screen.getByText('2023')).toBeVisible();
27+
expect(container).toHaveTextContent('Present');
28+
});
29+
});
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { render, screen } from '@testing-library/react';
2+
3+
import { Tags } from './Tags';
4+
5+
describe('Tags', () => {
6+
it('should render each tag', () => {
7+
render(<Tags tags={['React18', 'AWS']} />);
8+
9+
expect(screen.getByText('React18')).toBeVisible();
10+
expect(screen.getByText('AWS')).toBeVisible();
11+
});
12+
13+
it('should render empty container when tags are empty', () => {
14+
const { container } = render(<Tags tags={[]} />);
15+
16+
expect(container.firstChild).toBeEmptyDOMElement();
17+
});
18+
});
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import { render, screen } from '@testing-library/react';
2+
3+
import { Paragraph, Section, Sentence } from './Body';
4+
5+
describe('Body', () => {
6+
it('should render Section with top margin class when top is false', () => {
7+
const { container } = render(
8+
<ul>
9+
<Section>내용</Section>
10+
</ul>,
11+
);
12+
13+
expect(container.querySelector('li')).toHaveClass('mt-8');
14+
expect(screen.getByText('내용')).toBeVisible();
15+
});
16+
17+
it('should omit extra top margin when top is true', () => {
18+
const { container } = render(
19+
<ul>
20+
<Section top>상단</Section>
21+
</ul>,
22+
);
23+
24+
expect(container.querySelector('li')).not.toHaveClass('mt-8');
25+
});
26+
27+
it('should render Paragraph and Sentence', () => {
28+
render(
29+
<Paragraph>
30+
<Sentence value="첫 문장">추가</Sentence>
31+
</Paragraph>,
32+
);
33+
34+
expect(screen.getByRole('list')).toBeVisible();
35+
expect(screen.getByRole('listitem')).toHaveTextContent('첫 문장추가');
36+
});
37+
});

src/features/home/Container.spec.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,11 @@ describe('HomeContainer', () => {
3838
it('should fire analytics on click', async () => {
3939
render(<HomeContainer />);
4040

41-
await userEvent.click(
42-
screen.getByRole('link', { name: '포스트 목록으로 이동' }),
43-
);
41+
const link = screen.getByRole('link', { name: '포스트 목록으로 이동' });
42+
link.addEventListener('click', (event) => {
43+
event.preventDefault();
44+
});
45+
await userEvent.click(link);
4446

4547
expect(ga).toHaveBeenCalledWith('homeClick', {
4648
type: 'router-push',

src/features/post/PostNavigationContainer/PrevNext.spec.tsx

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,13 @@ describe('PrevNext', () => {
100100
/>,
101101
);
102102

103-
await userEvent.click(
104-
screen.getByRole('link', { name: '이전 글: prev-post title' }),
105-
);
103+
const link = screen.getByRole('link', {
104+
name: '이전 글: prev-post title',
105+
});
106+
link.addEventListener('click', (event) => {
107+
event.preventDefault();
108+
});
109+
await userEvent.click(link);
106110

107111
expect(mockSendGAEvent).toHaveBeenCalledWith('event', 'postNavigation', {
108112
type: 'prev',
@@ -119,9 +123,13 @@ describe('PrevNext', () => {
119123
/>,
120124
);
121125

122-
await userEvent.click(
123-
screen.getByRole('link', { name: '다음 글: next-post title' }),
124-
);
126+
const link = screen.getByRole('link', {
127+
name: '다음 글: next-post title',
128+
});
129+
link.addEventListener('click', (event) => {
130+
event.preventDefault();
131+
});
132+
await userEvent.click(link);
125133

126134
expect(mockSendGAEvent).toHaveBeenCalledWith('event', 'postNavigation', {
127135
type: 'next',

src/features/post/PostNavigationContainer/RelatedPostItem.spec.tsx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,11 @@ describe('RelatedPostItem', () => {
7979
/>,
8080
);
8181

82-
await userEvent.click(
83-
screen.getByRole('link', { name: /Sample Post Title/i }),
84-
);
82+
const link = screen.getByRole('link', { name: /Sample Post Title/i });
83+
link.addEventListener('click', (event) => {
84+
event.preventDefault();
85+
});
86+
await userEvent.click(link);
8587

8688
expect(mockSendGAEvent).toHaveBeenCalledWith('event', 'postNavigation', {
8789
type: 'similar',
@@ -99,9 +101,11 @@ describe('RelatedPostItem', () => {
99101
/>,
100102
);
101103

102-
await userEvent.click(
103-
screen.getByRole('link', { name: /Sample Post Title/i }),
104-
);
104+
const link = screen.getByRole('link', { name: /Sample Post Title/i });
105+
link.addEventListener('click', (event) => {
106+
event.preventDefault();
107+
});
108+
await userEvent.click(link);
105109

106110
expect(mockSendGAEvent).toHaveBeenCalledWith('event', 'postNavigation', {
107111
type: 'discovery',

0 commit comments

Comments
 (0)