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
|
import { describe, expect, it } from '@jest/globals';
import NextImage from 'next/image';
import { render, screen as rtlScreen } from '../../../../tests/utils';
import { Logo } from '../../atoms';
import { SiteHeader } from './site-header';
const nav = [
{ id: 'home-link', href: '#', label: 'Home' },
{ id: 'blog-link', href: '#', label: 'Blog' },
{ id: 'cv-link', href: '#', label: 'CV' },
{ id: 'contact-link', href: '#', label: 'Contact' },
];
const title = 'Assumenda quis quod';
describe('SiteHeader', () => {
it('renders the website title', () => {
render(
<SiteHeader
ackeeStorageKey="ackee-tracking"
isHome={true}
logo={<Logo />}
motionStorageKey="reduced-motion"
nav={nav}
photo={
<NextImage
alt="A photo"
height={200}
src="https://picsum.photos/200"
width={200}
/>
}
searchPage="#"
title={title}
/>
);
expect(
rtlScreen.getByRole('heading', { level: 1, name: title })
).toBeInTheDocument();
});
it('renders the main nav', () => {
render(
<SiteHeader
ackeeStorageKey="ackee-tracking"
logo={<Logo />}
motionStorageKey="reduced-motion"
nav={nav}
photo={
<NextImage
alt="A photo"
height={200}
src="https://picsum.photos/200"
width={200}
/>
}
searchPage="#"
title={title}
/>
);
expect(rtlScreen.getByRole('navigation')).toBeInTheDocument();
});
});
|