]> git.r.bdr.sh - rbdr/forum/blame - src/lib/components/header/header.test.ts
Update / use typescript
[rbdr/forum] / src / lib / components / header / header.test.ts
CommitLineData
a7cf03c1
RBR
1/**
2 * @jest-environment jsdom
3 */
4
55fb920b
RBR
5import '@testing-library/jest-dom/extend-expect';
6
7import { render } from '@testing-library/svelte';
a7cf03c1
RBR
8import '$lib/i18n';
9import { enableTopicActions } from '$lib/stores/actions';
55fb920b 10
a7cf03c1 11jest.mock('$lib/config/config.ts');
73973eda 12
55fb920b
RBR
13import Header from './header.svelte';
14
15describe('Header component', () => {
16
17 test('Should not display topic if action is not set', () => {
18
19 const results = render(Header);
20
21 expect(results.queryByTitle('Reply'))
22 .toBe(null);
23 });
24
25 test('Should display topic if action is set', () => {
26
27 enableTopicActions('d138d6d8-e669-42e7-995d-20a7fcc176f5');
28 const results = render(Header);
29
30 expect(results.getByTitle('Reply'))
31 .toBeVisible();
32 });
33});