Anvil/tests/components/atoms/BlockOrReport.test.ts

48 lines
1.1 KiB
TypeScript
Raw Normal View History

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();
});
});