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