aboutsummaryrefslogtreecommitdiff
path: root/src/lib/components/error_block/error_block.test.ts
blob: 401874f61b155f8861b54a06c6214e28b2e6c9c3 (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
/**
 * @jest-environment jsdom
 */

import '@testing-library/jest-dom/extend-expect';

import { render } from '@testing-library/svelte';
import '$lib/i18n';

import ErrorBlock from './error_block.svelte';

describe('Error Block component', () => {
	test('Should display error message sent', () => {
		const results = render(ErrorBlock, {
			props: {
				message: 'An error has, sadly, destroyed everything.'
			}
		});

		expect(results.getByText('An error has, sadly, destroyed everything.')).toBeVisible();
	});

	test('Should display default error message', () => {
		const results = render(ErrorBlock);

		expect(results.getByText('Unknown error has occurred. Panic!')).toBeVisible();
	});
});