import { describe, it, expect } from 'vitest';
import { countRequiredFilled } from './requiredFields';

describe('countRequiredFilled', () => {
	it('returns 0 when all three fields are empty', () => {
		expect(countRequiredFilled('', '', '')).toBe(0);
	});

	it('returns 1 when only title is set', () => {
		expect(countRequiredFilled('Ein Brief', '', '')).toBe(1);
	});

	it('returns 1 when only dateIso is set', () => {
		expect(countRequiredFilled('', '1920-05-01', '')).toBe(1);
	});

	it('returns 1 when only senderId is set', () => {
		expect(countRequiredFilled('', '', 'person-uuid')).toBe(1);
	});

	it('returns 2 when title and dateIso are set', () => {
		expect(countRequiredFilled('Ein Brief', '1920-05-01', '')).toBe(2);
	});

	it('returns 2 when title and senderId are set', () => {
		expect(countRequiredFilled('Ein Brief', '', 'person-uuid')).toBe(2);
	});

	it('returns 2 when dateIso and senderId are set', () => {
		expect(countRequiredFilled('', '1920-05-01', 'person-uuid')).toBe(2);
	});

	it('returns 3 when all three fields are set', () => {
		expect(countRequiredFilled('Ein Brief', '1920-05-01', 'person-uuid')).toBe(3);
	});
});
