2024-02-11 18:29:53 +01:00
|
|
|
import '@testing-library/jest-dom';
|
|
|
|
import { render, screen } from '@testing-library/svelte';
|
2024-02-19 11:33:41 +01:00
|
|
|
import { init, locale, register } from 'svelte-i18n';
|
2024-02-11 18:29:53 +01:00
|
|
|
|
|
|
|
import BlockOrReport from '../../../src/lib/components/atoms/BlockOrReport.svelte';
|
2024-02-19 11:33:41 +01:00
|
|
|
import enMessages from '../../../src/lib/i18n/locales/en.json';
|
2024-02-11 18:29:53 +01:00
|
|
|
|
|
|
|
describe('BlockOrReport.svelte', () => {
|
2024-02-19 11:33:41 +01:00
|
|
|
beforeEach(() => {
|
|
|
|
register('en', () => import('../../../src/lib/i18n/locales/en.json'));
|
|
|
|
init({ fallbackLocale: 'en', initialLocale: 'en' });
|
|
|
|
locale.set('en');
|
|
|
|
});
|
|
|
|
|
2024-02-11 18:29:53 +01:00
|
|
|
it('should mount', () => {
|
|
|
|
// Arrange
|
|
|
|
// Nothing to prepare
|
|
|
|
|
|
|
|
// Act
|
|
|
|
const { container } = render(BlockOrReport);
|
|
|
|
|
|
|
|
// Assert
|
|
|
|
expect(container).toBeTruthy();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should allow for block', () => {
|
|
|
|
// Arrange
|
|
|
|
// Nothing to prepare
|
|
|
|
|
|
|
|
// Act
|
|
|
|
render(BlockOrReport);
|
|
|
|
|
|
|
|
// Assert
|
2024-02-19 11:33:41 +01:00
|
|
|
expect(screen.getByRole('button', { name: 'block' })).toBeDefined();
|
2024-02-11 18:29:53 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should allow for report', () => {
|
|
|
|
// Arrange
|
|
|
|
// Nothing to prepare
|
|
|
|
|
|
|
|
// Act
|
|
|
|
render(BlockOrReport);
|
|
|
|
|
|
|
|
// Assert
|
2024-02-19 11:33:41 +01:00
|
|
|
expect(screen.getByRole('button', { name: 'report' })).toBeDefined();
|
2024-02-11 18:29:53 +01:00
|
|
|
});
|
|
|
|
});
|