Anvil/tests/components/atoms/DisplayName.test.ts
André Jaenisch fecd15f862
refactor: extract display name into component
I could imagine that we will refactor this into even smaller components
in the future but for now, I bundle the pronoun with the display name
like this.

Signed-off-by: André Jaenisch <andre.jaenisch@posteo.de>
2024-02-15 16:18:06 +01:00

20 lines
590 B
TypeScript

import '@testing-library/jest-dom';
import { render, screen } from '@testing-library/svelte';
import DisplayName from '../../../src/lib/components/atoms/DisplayName.svelte';
describe('DisplayName.svelte', () => {
it('should mount', () => {
// Arrange
const displayName = 'Jane Doe';
const pronoun = 'she/her';
// Act
render(DisplayName, { displayName, pronoun });
// Assert
expect(screen.getByText(displayName)).toBeInTheDocument();
// Turn into regular expression to respect round brackets
expect(screen.getByText(new RegExp(pronoun))).toBeInTheDocument();
});
});