Anvil/tests/components/atoms/BlockOrReport.test.ts
André Jaenisch 20a44974d5
refactor: turn Profile page into a component
This way it is easier to inspect the design implementation.

Signed-off-by: André Jaenisch <andre.jaenisch@posteo.de>
2024-02-20 13:29:52 +01:00

47 lines
1.1 KiB
TypeScript

import '@testing-library/jest-dom';
import { render, screen } from '@testing-library/svelte';
import { init, locale, register } from 'svelte-i18n';
import BlockOrReport from '../../../src/lib/components/atoms/BlockOrReport.svelte';
import enMessages from '../../../src/lib/i18n/locales/en.json';
describe('BlockOrReport.svelte', () => {
beforeEach(() => {
register('en', () => import('../../../src/lib/i18n/locales/en.json'));
init({ fallbackLocale: 'en', initialLocale: 'en' });
locale.set('en');
});
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
expect(screen.getByRole('button', { name: 'block' })).toBeDefined();
});
it('should allow for report', () => {
// Arrange
// Nothing to prepare
// Act
render(BlockOrReport);
// Assert
expect(screen.getByRole('button', { name: 'report' })).toBeDefined();
});
});