import { describe, it, expect, afterEach } from 'vitest';
import { cleanup, render } from 'vitest-browser-svelte';
import { page } from 'vitest/browser';
import RelationshipPill from './RelationshipPill.svelte';

afterEach(cleanup);

describe('RelationshipPill', () => {
	it('renders the supplied label', async () => {
		render(RelationshipPill, { props: { label: 'Vater' } });

		await expect.element(page.getByText('Vater')).toBeVisible();
	});

	it('renders an empty string label without crashing', async () => {
		render(RelationshipPill, { props: { label: '' } });

		const span = document.querySelector('span');
		expect(span).not.toBeNull();
	});
});
