]> git.r.bdr.sh - rbdr/forum/blob - src/components/header/header.test.js
7d57265f86f4da38ef66b1325ca4a5c7aa404e81
[rbdr/forum] / src / components / header / header.test.js
1 import '@testing-library/jest-dom/extend-expect';
2
3 import { render } from '@testing-library/svelte';
4 import '$/config/i18n';
5 import { enableTopicActions } from '$/stores/actions';
6
7 import Header from './header.svelte';
8
9 describe('Header component', () => {
10
11 test('Should not display topic if action is not set', () => {
12
13 const results = render(Header);
14
15 expect(results.queryByTitle('Reply'))
16 .toBe(null);
17 });
18
19 test('Should display topic if action is set', () => {
20
21 enableTopicActions('d138d6d8-e669-42e7-995d-20a7fcc176f5');
22 const results = render(Header);
23
24 expect(results.getByTitle('Reply'))
25 .toBeVisible();
26 });
27 });