-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSeriesHubCard.test.tsx
More file actions
79 lines (74 loc) · 2 KB
/
Copy pathSeriesHubCard.test.tsx
File metadata and controls
79 lines (74 loc) · 2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import { render, screen } from '@testing-library/react';
import { describe, expect, it, vi } from 'vitest';
import type { SeriesSummary } from '@/features/blog/model/series-group';
import SeriesHubCard from './SeriesHubCard';
vi.mock('./SeriesTrackedLink', () => ({
default: ({
href,
children,
className,
}: {
href: string;
children: React.ReactNode;
className?: string;
}) => (
<a href={href} className={className}>
{children}
</a>
),
}));
const summary: SeriesSummary = {
id: 'redis-deep-dive',
title: 'Redis 완전정복',
latestDate: '2026-03-10',
firstPostSlug: 'redis-1',
postCount: 2,
totalReadingMinutes: 18,
posts: [
{
slug: 'redis-1',
title: 'Redis 1편',
description: '기초를 다뤄요',
date: '2026-03-01',
category: 'Tech',
tags: ['Redis'],
readingTime: 8,
series: {
id: 'redis-deep-dive',
title: 'Redis 완전정복',
order: 1,
},
},
{
slug: 'redis-2',
title: 'Redis 2편',
description: '심화를 다뤄요',
date: '2026-03-10',
category: 'Tech',
tags: ['Redis'],
readingTime: 10,
series: {
id: 'redis-deep-dive',
title: 'Redis 완전정복',
order: 2,
},
},
],
};
describe('SeriesHubCard', () => {
it('renders series title and links without the redundant series badge', () => {
render(<SeriesHubCard summary={summary} seriesIndex={0} />);
expect(
screen.getByRole('heading', { level: 2, name: 'Redis 완전정복' })
).toBeInTheDocument();
expect(
screen.getByRole('link', { name: /첫 글부터 읽기/i })
).toHaveAttribute('href', '/blog/redis-1');
const firstEpisodeLink = screen.getByRole('link', {
name: /1\.?\s*Redis 1편/i,
});
expect(firstEpisodeLink).toHaveAttribute('href', '/blog/redis-1');
expect(firstEpisodeLink).toHaveClass('min-h-10', 'py-1.5');
expect(screen.queryByText('Series')).not.toBeInTheDocument();
});
});