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

afterEach(() => cleanup());

describe('GroupDivider', () => {
	it('renders the label text', async () => {
		render(GroupDivider, { label: '1938' });
		await expect.element(page.getByText('1938')).toBeInTheDocument();
	});

	it('has data-testid="group-divider" on the root element', async () => {
		render(GroupDivider, { label: 'Test' });
		await expect.element(page.getByTestId('group-divider')).toBeInTheDocument();
	});

	it('renders a person name label', async () => {
		render(GroupDivider, { label: 'Anna Müller' });
		await expect.element(page.getByText('Anna Müller')).toBeInTheDocument();
	});
});
