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

afterEach(cleanup);

describe('documents/new page', () => {
	it('renders the BulkDocumentEditLayout with prop pass-through', async () => {
		render(DocumentNewPage, {
			props: {
				data: {
					initialSenderId: 'p1',
					initialSenderName: 'Anna Schmidt',
					initialReceivers: []
				}
			}
		});

		const main = document.body.firstElementChild;
		expect(main).not.toBeNull();
	});

	it('renders without crashing when initial values are empty', async () => {
		render(DocumentNewPage, {
			props: {
				data: { initialSenderId: '', initialSenderName: '', initialReceivers: [] }
			}
		});

		const main = document.body.firstElementChild;
		expect(main).not.toBeNull();
	});
});
