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

21 lines
590 B
TypeScript
Raw Normal View History

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