aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/organisms/layout/cards-list.test.tsx
blob: 751a502e3e659e3e11cca324e42eddd7d369cfc9 (plain)
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
import { describe, expect, it } from '@jest/globals';
import { render, screen } from '../../../../tests/utils';
import { CardsList, type CardsListItem } from './cards-list';

const items: CardsListItem[] = [
  {
    id: 'card-1',
    cover: {
      alt: 'card 1 picture',
      src: 'http://placeimg.com/640/480',
      width: 640,
      height: 480,
    },
    meta: { thematics: ['Velit', 'Ex', 'Alias'] },
    tagline: 'Molestias ut error',
    title: 'Et alias omnis',
    url: '#',
  },
  {
    id: 'card-2',
    cover: {
      alt: 'card 2 picture',
      src: 'http://placeimg.com/640/480',
      width: 640,
      height: 480,
    },
    meta: { thematics: ['Voluptas'] },
    tagline: 'Quod vel accusamus',
    title: 'Laboriosam doloremque mollitia',
    url: '#',
  },
  {
    id: 'card-3',
    cover: {
      alt: 'card 3 picture',
      src: 'http://placeimg.com/640/480',
      width: 640,
      height: 480,
    },
    meta: {
      thematics: ['Quisquam', 'Quia', 'Sapiente', 'Perspiciatis'],
    },
    tagline: 'Quo error eum',
    title: 'Magni rem nulla',
    url: '#',
  },
];

describe('CardsList', () => {
  it('renders a list of cards', () => {
    render(<CardsList items={items} titleLevel={2} />);
    expect(screen.getAllByRole('heading', { level: 2 })).toHaveLength(
      items.length
    );
  });
});